public function actionLogin() { $this->layout = "login"; if (!\Yii::$app->user->isGuest) { $this->redirect(['index/index']); } $user = new User(); if (\Yii::$app->request->isPost) { if ($user->login(\Yii::$app->request->post())) { $this->redirect(['index/index']); } } return $this->render('login', ['model' => $user]); }