Files
newznab-tmux-NNTmux/app/Http/Middleware/Google2FAMiddleware.php
T
DariusIII ad05688ac6 CS fixes
2023-03-30 21:48:07 +02:00

26 lines
575 B
PHP

<?php
namespace App\Http\Middleware;
use App\Support\Google2FAAuthenticator;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class Google2FAMiddleware
{
/**
* Handle an incoming request.
*/
public function handle(Request $request, Closure $next): Response
{
$authenticator = app(Google2FAAuthenticator::class)->boot($request);
if ($authenticator->isAuthenticated()) {
return $next($request);
}
return $authenticator->makeRequestOneTimePasswordResponse();
}
}