Modified application templates so when trying to log in when already logged in it just redirects to homepage instead of throwing exceptions

This commit is contained in:
Alexander Makarov 2013-11-07 01:19:36 +04:00
parent d9735bc3b7
commit 4df6370173

View File

@ -16,13 +16,8 @@ class SiteController extends Controller
return [
'access' => [
'class' => AccessControl::className(),
'only' => ['login', 'logout'],
'only' => ['logout'],
'rules' => [
[
'actions' => ['login'],
'allow' => true,
'roles' => ['?'],
],
[
'actions' => ['logout'],
'allow' => true,
@ -59,6 +54,10 @@ class SiteController extends Controller
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
$this->goHome();
}
$model = new LoginForm();
if ($model->load($_POST) && $model->login()) {
return $this->goBack();