doucheng5705
2017-11-07 00:16
浏览 47
已采纳

在Laravel 5.5中更新用户密码后阻止注销

Beginning with Laravel 5.3, this middleware was added...

\Illuminate\Session\Middleware\AuthenticateSession

While it's definitely a benefit for security purposes, it's also responsible for logging the user out (presenting the user with the login page) if they change their password.

How do we prevent a user from being logged out (being forced to log back in) when they change their password, in Laravel 5.5?

图片转代码服务由CSDN问答提供 功能建议

从Laravel 5.3开始,添加了这个中间件......

\ n

\ Illuminate \ Session \ Middleware \ AuthenticateSession

虽然出于安全目的肯定是一个好处,但它也负责将用户注销(呈现用户) 如果他们更改了密码,请使用登录页面。

在Laravel 5.5中,我们如何防止用户在更改密码时被注销(被迫重新登录)?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doujiao2014 2017-11-07 00:23
    已采纳

    Instead of changing the middleware, just "re-login" the user after changing the password:

    <?php
    //$user->passwordChangeMagicHere()
    
    Auth::login($user);
    //And the user is logged in again!
    
    点赞 打赏 评论

相关推荐 更多相似问题