Laravel Auth Logout () + Session Flush () does not issue the user

I am unable to successfully exit my application for about 3 months.

Controller code on the logout path:

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

For what it's worth, the โ€œremember tokenโ€ column is not null in the user table, and the session configuration disk is a file.

EDIT:

I notice that the value of the storage token changes in the database after logging out, while it demonstrates login behavior.

+4
source share
2 answers

try using

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

To log out and redirect to the login screen

And use

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

In your controller, prevent the user from logging in to the system

+2

, , :

    //standard logout method
    Auth::logout();

    sleep(1);

    //finally logged out!!!!
    Auth::logout();
-2

All Articles