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('auth', 'Undefined user or password.')); } return $user; } }