Alfiza malek
Alfiza malek

Reputation: 1004

Laravel gives an error for logout when the session timedout

In my laravel project when i click on logout and if the session is timed out it shows and error for token miss match.But i want like it goes to the login page.how to solve this.

enter image description here

In other pages when session timedout it goes to the login page i want same for the logout.

in my web all other pages are under the following auth middleware thats may be the reason other pages works fine.

Route::group(['middleware' => ['auth', 'changepassword']], function () 
{ }

Upvotes: 4

Views: 1408

Answers (1)

LoKat
LoKat

Reputation: 1219

You could add the logout route to the VerifyCsrfToken exceptions list:

protected $except = [
    'your/logout/route'
];

You can find the class in App/Http/Middleware. If you have any code doing stuff in the logout function that you only want logged in users to be able to, then you would have to add checks to see if the user session has timed out and act accordingly.

Upvotes: 5

Related Questions