Laravel - 浏览器关闭后身份验证会话未过期
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25114267/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel - Auth Session not expiring after browser close
提问by yenerunver
I am having a problem about sessions, or cookies, I didn't understand the reason.
我有关于会话或 cookie 的问题,我不明白原因。
I log on to my site with Auth::attempt($userdata, false)
, which means Laravel should not remember my login, but it remembers whether I use true or false in attempt function.
我用 登录到我的网站Auth::attempt($userdata, false)
,这意味着 Laravel 不应该记住我的登录信息,但它会记住我在尝试功能中使用 true 还是 false。
in app/config/session.php
, variables are determined as
在app/config/session.php
,变量被确定为
'lifetime' => 120,
'expire_on_close' => true,
Also, when I log in with Auth::attempt($userdata, true)
, 'Auth::viaRemember()'
function returns false
.
此外,当我使用 登录时Auth::attempt($userdata, true)
,'Auth::viaRemember()'
函数返回false
。
Edit:Question solved. Cause of the problem is Chrome. See my answer for detailed information.
编辑:问题已解决。问题的原因是 Chrome。有关详细信息,请参阅我的回答。
采纳答案by yenerunver
I have solved my own question. It appeared that the problem is Chrome's problem. It continues to work in background, so the cookie values do not disappear. I tried my app with firefox and works perfectly.
我已经解决了我自己的问题。看来问题是Chrome的问题。它继续在后台工作,因此 cookie 值不会消失。我在 Firefox 上尝试了我的应用程序并且运行良好。
For more info: https://code.google.com/p/chromium/issues/detail?id=128513
更多信息:https: //code.google.com/p/chromium/issues/detail?id=128513
回答by peter.babic
It is a desired behavior to be logged in after you re-open the browser.
You can change this in app/config/session.php
by setting
重新打开浏览器后登录是一种理想的行为。您可以app/config/session.php
通过设置更改此
'expire_on_close' => true,