mein-sterntours/app/Http/Middleware/MiddleGoogle2FA.php
Kevin Adametz 881fc84207 08 2024
2024-08-05 11:58:09 +02:00

23 lines
No EOL
589 B
PHP

<?php
namespace App\Http\Middleware;
use Auth;
use Closure;
use App\Services\AuthGoogle2FA;
class MiddleGoogle2FA
{
public function handle($request, Closure $next)
{
$AuthGoogle2FA = app(AuthGoogle2FA::class)->init($request);
if(!Auth::user()->isGoogle2Fa()){
\App\Services\MyGoogle2FA::logout();
return $AuthGoogle2FA->makeActiveOneTimePasswordResponse();
}
if ($AuthGoogle2FA->isAuthenticated()) {
return $next($request);
}
return $AuthGoogle2FA->makeRequestOneTimePasswordResponse();
}
}