3
0
Fork 0
This repository has been archived on 2024-11-14. You can view files and clone it, but cannot push or open issues or pull requests.
ThemeParkPlus-Panel/app/Http/Middleware/TwoFactorAuthentication.php

28 lines
583 B
PHP
Raw Normal View History

2020-02-26 13:59:58 +00:00
<?php
namespace App\Http\Middleware;
use Closure;
use PragmaRX\Google2FALaravel\Support\Authenticator;
class TwoFactorAuthentication
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$authenticator = app(Authenticator::class)->boot($request);
if ($authenticator->isAuthenticated()) {
return $next($request);
}
return redirect()->route('2fa.authenticate');
}
}