GCTC-NTGC /
TalentCloud
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Http\Middleware; |
||
| 4 | |||
| 5 | use App\Exceptions\TwoFactorRequiredException; |
||
| 6 | use Closure; |
||
| 7 | use PragmaRX\Google2FALaravel\Support\Authenticator; |
||
| 8 | use PragmaRX\Google2FALaravel\Middleware; |
||
| 9 | |||
| 10 | class Require2FA extends Middleware |
||
| 11 | { |
||
| 12 | public function handle($request, Closure $next) |
||
| 13 | { |
||
| 14 | $authenticator = app(Authenticator::class)->boot($request); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 15 | |||
| 16 | if (!$authenticator->isActivated()) { |
||
| 17 | throw new TwoFactorRequiredException(); |
||
| 18 | } |
||
| 19 | |||
| 20 | return parent::handle($request, $next); |
||
| 21 | } |
||
| 22 | } |
||
| 23 |