Commit d6692093 by Alexander Makarov

Fixed advanced application to use POST for logout

parent a7a1bd8d
...@@ -37,7 +37,11 @@ AppAsset::register($this); ...@@ -37,7 +37,11 @@ AppAsset::register($this);
if (Yii::$app->user->isGuest) { if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
} else { } else {
$menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => ['/site/logout']]; $menuItems[] = [
'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post']
];
} }
echo Nav::widget([ echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'], 'options' => ['class' => 'navbar-nav navbar-right'],
......
...@@ -41,7 +41,11 @@ AppAsset::register($this); ...@@ -41,7 +41,11 @@ AppAsset::register($this);
$menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']]; $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']];
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
} else { } else {
$menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => ['/site/logout']]; $menuItems[] = [
'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post']
];
} }
echo Nav::widget([ echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'], 'options' => ['class' => 'navbar-nav navbar-right'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment