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