users = $users; } public function auth(LoginForm $form): User { $user = $this->users->findByUsernameOrEmail($form->username); if (!$user || !$user->isActive() || !$user->validatePassword($form->password)) { throw new \DomainException(Yii::t('user', 'Undefined user or password.')); } return $user; } }