| @@ 61-75 (lines=15) @@ | ||
| 58 | return $this->render('index'); |
|
| 59 | } |
|
| 60 | ||
| 61 | public function actionLogin() |
|
| 62 | { |
|
| 63 | if (!\Yii::$app->user->isGuest) { |
|
| 64 | return $this->goHome(); |
|
| 65 | } |
|
| 66 | ||
| 67 | $model = new LoginForm(); |
|
| 68 | if ($model->load(Yii::$app->request->post()) && $model->login()) { |
|
| 69 | return $this->goBack(); |
|
| 70 | } else { |
|
| 71 | return $this->render('login', [ |
|
| 72 | 'model' => $model, |
|
| 73 | ]); |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| 77 | public function actionLogout() |
|
| 78 | { |
|
| @@ 83-97 (lines=15) @@ | ||
| 80 | * |
|
| 81 | * @return mixed |
|
| 82 | */ |
|
| 83 | public function actionLogin() |
|
| 84 | { |
|
| 85 | if (!\Yii::$app->user->isGuest) { |
|
| 86 | return $this->goHome(); |
|
| 87 | } |
|
| 88 | ||
| 89 | $model = new LoginForm(); |
|
| 90 | if ($model->load(Yii::$app->request->post()) && $model->login()) { |
|
| 91 | return $this->goBack(); |
|
| 92 | } else { |
|
| 93 | return $this->render('login', [ |
|
| 94 | 'model' => $model, |
|
| 95 | ]); |
|
| 96 | } |
|
| 97 | } |
|
| 98 | ||
| 99 | /** |
|
| 100 | * Logs out the current user. |
|