mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-19 11:14:06 +00:00
Fix session not invalidated on logout causing CSRF mismatch on re-login
The web logout route called Auth::guard('web')->logout() but didn't
invalidate the session or regenerate the CSRF token. The browser kept
sending the old session cookie, causing CSRF token mismatch errors
when logging in as a different user.
This commit is contained in:
@@ -32,6 +32,9 @@ Route::post('login', [LoginController::class, 'login']);
|
|||||||
|
|
||||||
Route::post('auth/logout', function () {
|
Route::post('auth/logout', function () {
|
||||||
Auth::guard('web')->logout();
|
Auth::guard('web')->logout();
|
||||||
|
|
||||||
|
request()->session()->invalidate();
|
||||||
|
request()->session()->regenerateToken();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Customer auth
|
// Customer auth
|
||||||
|
|||||||
Reference in New Issue
Block a user