mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 21:01:30 +00:00
26 lines
575 B
PHP
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();
|
|
}
|
|
}
|