From 19a872c4228f6f2a6ad8e75001e78b755ab09b2c Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Mon, 12 Aug 2013 13:19:37 -0400 Subject: [PATCH] Added Controller::goHome(). --- controllers/SiteController.php | 4 ++-- views/layouts/main.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/controllers/SiteController.php b/controllers/SiteController.php index 0c73873..cd0b3fb 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -31,7 +31,7 @@ class SiteController extends Controller { $model = new LoginForm(); if ($model->load($_POST) && $model->login()) { - return $this->redirect(array('site/index')); + return $this->goHome(); } else { return $this->render('login', array( 'model' => $model, @@ -42,7 +42,7 @@ class SiteController extends Controller public function actionLogout() { Yii::$app->user->logout(); - return $this->redirect(array('site/index')); + return $this->goHome(); } public function actionContact() diff --git a/views/layouts/main.php b/views/layouts/main.php index 67b74af..03b09fc 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -37,7 +37,8 @@ app\config\AppAsset::register($this); Yii::$app->user->isGuest ? array('label' => 'Login', 'url' => array('/site/login')) : array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')), - ))); + ), + )); NavBar::end(); ?>