authTimeout in Yii2

后端 未结 6 816
余生分开走
余生分开走 2021-01-12 17:22

I am trying to log out user automatically in yii2 after he is idle for a fixed seconds . In web.php I added

\'user\' => [
             


        
6条回答
  •  有刺的猬
    2021-01-12 18:00

    Your config is correct. But it will not automatically refresh your page and show you login form. Technically it will log you out only at the next request after the session is expired. And you should be aware of ajax scripts working on your page and calling some other pages by time interval. Every request will renew your session timeout. There is also "absoluteAuthTimeout" parameter instead of "authTimeout" - that will log you out after the timeout despite of your activity.

提交回复
热议问题