public function actionLogin($modal = null) { if (!\Yii::$app->user->isGuest) { $this->goHome(); } $model = new LoginForm(); //make the captcha required if the unsuccessful attempts are more of thee if ($this->getLoginAttempts() >= $this->module->attemptsBeforeCaptcha) { $model->scenario = 'withCaptcha'; } if ($model->load($_POST)) { if ($model->login()) { $this->setLoginAttempts(0); //if login is successful, reset the attempts if ($modal) { ModalIFrame::refreshPage(); } return $this->goBack(); } else { //if login is not successful, increase the attempts $this->setLoginAttempts($this->getLoginAttempts() + 1); Yii::$app->session->setFlash(Alert::TYPE_DANGER, Yii::t('gromver.platform', 'Authorization is failed.')); } } if ($modal) { Yii::$app->grom->layout = 'modal'; } else { $this->module->layout = $this->module->loginLayout; } return $this->render('login', ['model' => $model]); }
public function actionLogin() { if (!\Yii::$app->user->isGuest) { $this->goHome(); } $model = new LoginForm(); //make the captcha required if the unsuccessful attempts are more of thee if ($this->getLoginAttempts() >= $this->module->attemptsBeforeCaptcha) { $model->scenario = 'withCaptcha'; } if ($model->load($_POST)) { if ($model->login()) { $this->setLoginAttempts(0); //if login is successful, reset the attempts return $this->goBack(); } else { //if login is not successful, increase the attempts $this->setLoginAttempts($this->getLoginAttempts() + 1); } } $this->module->layout = $this->module->loginLayout; return $this->render('login', ['model' => $model]); }