Reputation: 2225
I've been experiencing inability to successfully logout of my application for about 3 months.
The controller code on the logout route:
Auth::logout();
Session::flush();
For what it's worth, the remember token column is not null in the users table, and the session config drive is file.
EDIT:
I notice the remember token value is being changed in the DB after logout while exhibiting behavior of staying logged in.
Upvotes: 4
Views: 6002
Reputation: 2225
In the spirit of solving problems and moving on, here's what works as a band-aid:
//standard logout method
Auth::logout();
sleep(1);
//finally logged out!!!!
Auth::logout();
Upvotes: -2
Reputation: 1875
try using
public function getLogout() {
Auth::logout();
// Session::flush();
return Redirect::to('login')->with('message', 'Your are now logged out!');
}
To logout and redirect to your 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 to restrict a user not login to login
Upvotes: 3