feat(KAN-21): rebuild login verification and two-factor flows
CI/CD / test_and_check_app (push) Canceled after 0s
CI/CD / Publish immutable image (push) Canceled after 0s
CI/CD / Publish immutable image (pull_request) Canceled after 0s
CI/CD / test_and_check_app (pull_request) Canceled after 6s

This commit is contained in:
2026-09-11 14:18:23 +02:00
parent 5e52e4fe78
commit 802294d6a2
17 changed files with 1294 additions and 250 deletions
@@ -28,7 +28,8 @@ class VerificationNotificationTest extends TestCase
$this->actingAs($user)
->post(route('verification.send'))
->assertRedirect(route('home'));
->assertRedirect(route('home'))
->assertSessionHas('status', 'verification-link-sent');
Notification::assertSentTo($user, VerifyEmail::class);
}
@@ -45,4 +46,27 @@ class VerificationNotificationTest extends TestCase
Notification::assertNothingSent();
}
public function test_guests_cannot_request_a_verification_email(): void
{
Notification::fake();
$this->post(route('verification.send'))->assertRedirect(route('login'));
Notification::assertNothingSent();
}
public function test_resending_verification_emails_is_throttled(): void
{
Notification::fake();
$user = User::factory()->unverified()->create();
$this->actingAs($user);
for ($attempt = 0; $attempt < 6; $attempt++) {
$this->post(route('verification.send'))->assertRedirect();
}
$this->post(route('verification.send'))->assertTooManyRequests();
Notification::assertSentToTimes($user, VerifyEmail::class, 6);
}
}