예제 #1
0
 public function getUser()
 {
     if ($this->_user == null) {
         $this->_user = User::findByEmail($this->email);
     }
     return $this->_user;
 }
예제 #2
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [['email', 'filter', 'filter' => 'trim'], ['email', 'required'], ['email', 'email'], ['email', 'exist', 'targetClass' => \Yii::$app->user->identityClass, 'message' => Yii::t('users', 'There is no user with such email.')], ['email', function ($attribute) {
         $this->_user = User::findByEmail($this->email);
         if ($this->_user !== null && $this->getModule()->confirmable && !$this->_user->getIsConfirmed()) {
             $this->addError($attribute, Yii::t('users', 'You need to confirm your email address'));
         }
     }], ['password', 'required', 'on' => 'reset'], ['password', 'string', 'min' => 6, 'on' => 'reset']];
 }