2FA-Challenge: Fehlversuch crasht nicht mehr (Route two-factor.login fehlt)

Fortifys FailedTwoFactorLoginResponse leitet auf die Route
two-factor.login um, die bei views => false nie registriert wird
(RouteNotFoundException). Eigener Response leitet zurück auf die
Volt-Challenge-Seite und meldet den Fehler auf Deutsch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-07 10:58:17 +00:00
parent 15387d0a3f
commit b42e0e3f62
3 changed files with 65 additions and 0 deletions

View file

@ -78,6 +78,35 @@ test('a valid two-factor code completes login with a role-aware redirect', funct
$this->assertAuthenticatedAs($customer);
});
test('an invalid two-factor code returns to the challenge page with an error', function () {
/** @var TestCase $this */
$user = User::factory()->create(['is_active' => true]);
enableTwoFactor($user);
$this->withSession(['login.id' => $user->id, 'login.remember' => false])
->post('/two-factor-challenge', ['code' => '000000'])
->assertRedirect(route('two-factor.challenge'))
->assertSessionHasErrors('code');
$this->assertGuest();
});
test('an invalid recovery code returns to the challenge page with an error', function () {
/** @var TestCase $this */
$user = User::factory()->create(['is_active' => true]);
enableTwoFactor($user);
$user->forceFill([
'two_factor_recovery_codes' => encrypt(json_encode(['gueltiger-code'])),
])->save();
$this->withSession(['login.id' => $user->id, 'login.remember' => false])
->post('/two-factor-challenge', ['recovery_code' => 'falscher-code'])
->assertRedirect(route('two-factor.challenge'))
->assertSessionHasErrors('recovery_code');
$this->assertGuest();
});
test('the fortify login post blocks inactive but verified users', function () {
/** @var TestCase $this */
$user = User::factory()->create(['is_active' => false]);