2FAuth/app/Http/Middleware/ForceLogout.php
2024-11-09 14:13:24 +01:00

26 lines
468 B
PHP

<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class ForceLogout
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param string $guards
* @return mixed
*/
public function handle($request, Closure $next, ...$guards)
{
if (Auth::user() != null) {
Auth::logoutCurrentDevice();
}
return $next($request);
}
}