public function actionLogin()
	{
		$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(Yii::$app->request->post()) {
            if($model->load($_POST) && $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);
            }
		}

		return $this->render('login', [
			'model' => $model,
		]);
	}
public function actionLogin()
	{
		$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(Yii::$app->request->post()) {
            if($model->load($_POST) && $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);
            }
		}

		return $this->render('login', [
			'model' => $model,
		]);
	}
public function actionLogin ( ) { $ 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 ( Yii :: $ app -> request -> post ( ) ) { if ( $ model -> load ( $ _POST ) && $ 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 ) ; } } return $ this -> render ( 'login' , [ 'model' => $ model , ] ) ; }
Shows the login form

@return string|\yii\web\Response
Shows the login form