mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-22 00:03:09 +01:00
Add session clean-up on Logout
This commit is contained in:
parent
159f715410
commit
580fb396e5
@ -8,7 +8,6 @@
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@ -90,10 +89,13 @@ public function login(LoginRequest $request)
|
||||
*/
|
||||
public function logout(Request $request)
|
||||
{
|
||||
$user = $request->user();
|
||||
Auth::logout();
|
||||
$userId = $request->user()->id;
|
||||
|
||||
Log::info(sprintf('User ID #%s logged out', $user->id));
|
||||
$this->guard()->logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
Log::info(sprintf('User ID #%s logged out', $userId));
|
||||
|
||||
return response()->json(['message' => 'signed out'], Response::HTTP_OK);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user