public function validateAttribute($model, $attribute) { $identity = UserIdentity::findByLogin($model->login); if (!$identity) { $this->addError($model, $attribute, Yii::t('user', 'You do not have access to this service. You may have incorrectly entered your username or password. If the reason is not that - talk to your teacher')); } }
public static function login($login) { $identity = UserIdentity::findByLogin($login); return Yii::$app->user->login($identity); }