controllers/DefaultController.php
public function actionLogin($view = 'login', $partial = false)
    {
        if (!\Yii::$app->user->isGuest) {
            return $this->goHome();
        }
        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            return $this->redirect($this->getLoginRedirect());
        }
        if (\Yii::$app->request->isAjax || $partial) {
            return $this->renderAjax($view, compact('model'));
        }
        return $this->render($view, compact('model'));
    }
public function actionLogin($view = 'login', $partial = false)
    {
        if (!\Yii::$app->user->isGuest) {
            return $this->goHome();
        }
        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            return $this->redirect($this->getLoginRedirect());
        }
        if (\Yii::$app->request->isAjax || $partial) {
            return $this->renderAjax($view, compact('model'));
        }
        return $this->render($view, compact('model'));
    }
public function actionLogin ( $ view = 'login' , $ partial = false ) { if ( ! \ Yii :: $ app -> user -> isGuest ) { return $ this -> goHome ( ) ; } $ model = new LoginForm ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> login ( ) ) { return $ this -> redirect ( $ this -> getLoginRedirect ( ) ) ; } if ( \ Yii :: $ app -> request -> isAjax || $ partial ) { return $ this -> renderAjax ( $ view , compact ( 'model' ) ) ; } return $ this -> render ( $ view , compact ( 'model' ) ) ; }
Renders login form.
@param string $view
@param bool $partial
@return string view.
Renders login form .