Sep 8, 2024
0
Level 1
Bug in 2FA with Fortify
We have buttons for enabling and disabling two-factor authentication. When you click on the 2FA enable button, the middleware intercepts a POST request and requires you to enter a password confirmation. After entering the password, you are redirected to the page with the “Enable 2FA” button.
Expected: POST request execution after password confirmation. The same thing happens after clicking the “Disable 2FA” button with a DELETE request.
{{-- config/fortify.php --}}
'features' => [
Features::twoFactorAuthentication([
'confirmPassword' => true,
]),
],
{{-- Enable 2FA --}}
<form method="POST" action="{{ route('two-factor.enable') }}">
@csrf
<button type="submit" class="btn btn-primary btn-sm">
{{ __('Enable Two-Factor') }}
</button>
</form>
{{-- Disable 2FA --}}
<form method="POST" action="{{ route('two-factor.disable').'#2FA' }}">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-primary btn-sm">
{{ __('Disable Two-Factor') }}
</button>
</form>
Am I missing something?
Please or to participate in this conversation.