Initial commit
This commit is contained in:
commit
b105bd7db7
171 changed files with 28322 additions and 0 deletions
27
app/Http/Middleware/TwoFactorAuthentication.php
Normal file
27
app/Http/Middleware/TwoFactorAuthentication.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?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');
|
||||
}
|
||||
}
|
Reference in a new issue