Added Controller::goHome().

This commit is contained in:
Qiang Xue
2013-08-12 13:19:37 -04:00
parent 89fa7ed3cb
commit 27ad7e1fc7
6 changed files with 47 additions and 18 deletions

View File

@@ -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()

View File

@@ -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();
?>