Esempio n. 1
0
 /**
  * Send a recovery password token.
  *
  * @return boolean true if recovery token was successfully sent
  */
 public function recovery()
 {
     $this->_model = User::findByEmail($this->email, 'active');
     if ($this->_model !== null) {
         return $this->send();
     }
     return false;
 }
Esempio n. 2
0
 /**
  * Send a recovery password token.
  *
  * @return boolean true if recovery token was successfully sent
  */
 public function recovery()
 {
     $this->_model = User::findByEmail($this->email, 'active');
     if ($this->_model !== null) {
         $this->_model->token = Security::generateExpiringRandomString();
         $this->_model->save();
         return $this->send();
     }
     return false;
 }
Esempio n. 3
0
 /**
  * Finds user by username.
  *
  * @return User|boolean User instance
  */
 protected function getUser()
 {
     if ($this->_user === false) {
         $user = User::findByEmail($this->username, 'active');
         if ($user !== null) {
             if ($this->module->isBackend) {
                 if (Yii::$app->authManager->checkAccess($user->id, 'accessBackend')) {
                     $this->_user = $user;
                 }
             } else {
                 $this->_user = $user;
             }
         }
     }
     return $this->_user;
 }