是否可以在Laravel 5.8中“锁定”会话?

时间:2019-03-03 17:15:01

标签: laravel laravel-5.8

我想在我的应用程序中实现“锁定窗口”功能。是否可以锁定会话并重新激活它?

情况: x分钟后,该应用程序将被锁定。现在,用户必须输入密码,并将其重定向到以前的路由,然后再次登录。

1 个答案:

答案 0 :(得分:1)

在/config/session.php中,您可以设置会话到期前的空闲时间:

cmd.exe

如果要包括非空闲时间,则可以创建一些中间件,该中间件可以自动注销用户。您可以存储用户登录会话的时间,并在中间件中存储 /* |-------------------------------------------------------------------------- | 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, // edit this 变量。您可以像这样强制注销auth用户:

$timeout

如果登录时间+ auth()->logout()已过。

相关问题