Exemplo n.º 1
0
 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 public function getUser()
 {
     if ($this->_user === false) {
         $this->_user = User::findByLogin($this->login);
     }
     return $this->_user;
 }
Exemplo n.º 2
0
 public function existLogin($attribute, $params)
 {
     if (User::findByLogin($this->{$attribute})) {
         $this->addError($attribute, $params['message']);
         return false;
     } else {
         return true;
     }
 }
Exemplo n.º 3
0
 public function login()
 {
     $this->password_hash = Yii::$app->security->generatePasswordHash($this->password);
     $this->user = User::findByLogin($this->login);
     if ($this->validate() === false) {
         return false;
     }
     return Yii::$app->user->login($this->user, 60 * 60 * 24 * 365);
 }