/** * @return bool */ public function validateEmailConfirmedAndUserActive() { // if ( !Yii::$app->getModule('user-management')->checkAttempts() ) { // $this->addError('email', UserManagementModule::t('front', 'Too many attempts')); // return false; // } $user = SysUser::findOne(['email' => $this->email, 'deleted' => 0]); if ($user) { $this->user = $user; } else { $this->addError('email', Yii::t('app', 'Email is invalid')); } }
/** * Finds the SysUser model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return SysUser the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = SysUser::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }