/** * Authenticates the password. * This is the 'authenticate' validator as declared in rules(). */ public function authenticate($attribute=null, $params=null) { $identity = new AAUserIdentity($this->login, $this->password); $identity->authenticate(); switch($identity->errorCode) { case AAUserIdentity::ERROR_NONE: { $duration = $this->rememberMe ? 3600*24*7 : 0; // 30 days Yii::app()->user->login($identity, $duration); return true; } case AAUserIdentity::ERROR_USER_DISABLED: $this->addError('login', Yii::t('AutoAdmin.errors', 'Sorry, your account is blocked')); break; default: $this->addError('password', Yii::t('AutoAdmin.errors', 'Login or password is incorrect')); break; } return false; }