示例#1
0
 /**
  * @return User
  */
 public function getUser()
 {
     if ($this->_user === null) {
         $this->_user = $this->finder->findUserByEmail($this->email);
     }
     return $this->_user;
 }
示例#2
0
 /** @inheritdoc */
 public function rules()
 {
     return ['emailTrim' => ['email', 'filter', 'filter' => 'trim'], 'emailRequired' => ['email', 'required'], 'emailPattern' => ['email', 'email'], 'emailExist' => ['email', 'exist', 'targetClass' => User::className(), 'message' => Yii::t('user', 'There is no user with this email address')], 'emailUnconfirmed' => ['email', function ($attribute) {
         $this->user = $this->finder->findUserByEmail($this->email);
         if ($this->user !== null && $this->module->enableConfirmation && !$this->user->isConfirmed) {
             $this->addError($attribute, Yii::t('user', 'You need to confirm your email address'));
         }
         if ($this->user->isBlocked) {
             $this->addError($attribute, Yii::t('user', 'Your account has been blocked'));
         }
     }], 'passwordRequired' => ['password', 'required'], 'passwordLength' => ['password', 'string', 'min' => 6]];
 }