Laravel 5-从所有设备中注销用户 [英] Laravel 5 - Logout a user from all of his devices

查看:330
本文介绍了Laravel 5-从所有设备中注销用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户已登录.他还已经在3台不同的计算机上登录. 现在,用户更改了密码.

A user is logged in. And he's also already logged in in 3 different computers. Now user changes his password.

我想做些事情以从他的所有设备中注销他.默认情况下,如果我们在一台设备上更改密码,则在其他设备上什么也没有发生.

I want to do something to log him out from all of his devices. By default if we change password in one device, nothing happens on other devices.

首先要想到的是检查中间件(每次请求)中的密码,这不好,并且会显着降低性能.

The first thing that comes in mind is to check password in a middle-ware (every request) which is not good and decreases performance significantly.

我如何在Laravel 5中做到这一点?

How can I do this in Laravel 5?

AND 什么是最好的方法?大型网站如何从所有设备注销用户?

推荐答案

在最新版本的Laravel 5.6中

In the latest version of Laravel 5.6

您可以通过

auth()->logoutOtherDevices();

logoutOtherDevices

更多信息

这篇关于Laravel 5-从所有设备中注销用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆