Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     if (!\Yii::$app->user->isGuest) {
         return $this->controller->goHome();
     }
     $model = \Yii::createObject(LoginForm::className());
     if ($model->load(\Yii::$app->request->post()) && $model->login()) {
         if ($this->returnUrl) {
             return $this->controller->redirect($this->returnUrl);
         } else {
             return $this->controller->goBack();
         }
     } else {
         return $this->controller->render($this->tpl, ['model' => $model]);
     }
 }