Hi guys,
I noticed following behaviour in my yii2 project:
If I will close application without signing out, I will automatically signed in at next start if there remained other websites in browser. Only If I delete browser cache or if I will close browser totally(pushing cross right at the top), this behaviour can be avoided. In my Url-rules I defined first script to start should be site/login.php
Any ideas how to fix this? I want to get started LoginPage no matter what application has been closed!
Here are my Url-Rules in frontend(frontend/config/main.php)
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => true,
'enableStrictParsing' => true,
'class' => 'yii\web\UrlManager',
'rules' => [
'/' => 'site/login',
'home' => 'site/index',
'reset' => 'site/request-password-reset',
'about' => 'site/about',
'contact' => 'site/contact',
'logout' => 'site/logout',
'signup' => 'site/signup',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<action:(contact|captcha)>' => 'site/<action>'
],
],
'urlManagerBackend' => [
'class' => 'yii\web\UrlManager',
'baseUrl' => '/yii2_perswitch/backend/web/index.php',
],
Here are relevant methods in SiteController:
public function behaviors() {
return ['access' => [
'class' => AccessControl::className(),
'only' => ['logout', 'signup'],
'rules' => [[
'actions' => ['signup'],
'allow' => true,
'roles' => ['?'],],
[
'actions' => ['logout'],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'logout' => ['post'],
],
],
];
}
public function actions() {
return [
'error' => [
'class' => 'yii\web\ErrorAction',],
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,],];
}