Laravel 身份验证注销() + 会话刷新() 未注销用户


Laravel Auth Logout() + Session Flush() not logging out user

我已经无法成功注销我的应用程序大约 3 个月了。

注销路由上的控制器代码:

Auth::logout();
Session::flush();

值得一提的是,记住令牌列在用户表中不为空,会话配置驱动器是文件。

编辑:

我注意到注销后数据库中的记住令牌值正在更改,同时表现出保持登录状态的行为。

尝试使用

public function getLogout() {
    Auth::logout();
    // Session::flush();
    return Redirect::to('login')->with('message', 'Your are now logged out!');
}

注销并重定向到您的登录屏幕

并使用

public function __construct() {
    $this->beforeFilter(function(){
        if (!Auth::check())
            return Redirect::to('admin/login')->with('message', 'You need to be logged in!');
    });
}

在您的控制器中限制用户不登录以登录

本着

解决问题和继续前进的精神,以下是创可贴:

    //standard logout method
    Auth::logout();
    sleep(1);
    //finally logged out!!!!
    Auth::logout();