mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-31 10:18:55 +00:00
Add support for 2 Factor Authentification (2FA)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Support\Google2FAAuthenticator;
|
||||
use Closure;
|
||||
|
||||
class Google2FAMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$authenticator = app(Google2FAAuthenticator::class)->boot($request);
|
||||
|
||||
if ($authenticator->isAuthenticated()) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return $authenticator->makeRequestOneTimePasswordResponse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user