When user logged-in and remains inactive, How many seconds after that system logouts the user automatically? How to change this setting?
1 Answer
Assuming you are using the session driver to handle your authentication, you can change the time period for an idle session to expire in the /app/config/session.php
file.
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => 120,
'expire_on_close' => false,
-
2So after 120 s , to all the Auth::user will be auto logged out ? Is that correct ?– ioriNov 24, 2014 at 16:53
-
3
-
3Ohh nice. Thanks for clarify. So I assume at the 119.999 minutes the program will automatically called the Auth::logout(); function at some point. Is that right ? Do you know where that in Laravel ? The reason why I am asking this, is because I want to set some value into my database before the log-out function. I hope to hear back from you. :)– ioriNov 25, 2014 at 13:51
-
2The program will not automatically log the user out. Every time the user access a page on the site it will do a check to see if the time between their last visit is > x minutes . If it is, then the application logs them out, but the user needs to visit the site to trigger this.– JeemusuMar 4, 2015 at 2:53
-
1@NightMICU If you want to trigger some code every time a user is logged out, you could use an event subscriber for the
auth.logout
event.– JeemusuMar 4, 2015 at 2:54