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

This commit is contained in:
2026-09-10 11:02:15 +02:00
parent 7edd8daf49
commit a43aff0477
17 changed files with 1294 additions and 250 deletions
+30 -2
View File
@@ -61,7 +61,7 @@ class EmailVerificationTest extends TestCase
['id' => $user->id, 'hash' => sha1('wrong-email')],
);
$this->actingAs($user)->get($verificationUrl);
$this->actingAs($user)->get($verificationUrl)->assertForbidden();
Event::assertNotDispatched(Verified::class);
$this->assertFalse($user->fresh()->hasVerifiedEmail());
@@ -79,7 +79,7 @@ class EmailVerificationTest extends TestCase
['id' => 123, 'hash' => sha1($user->email)],
);
$this->actingAs($user)->get($verificationUrl);
$this->actingAs($user)->get($verificationUrl)->assertForbidden();
Event::assertNotDispatched(Verified::class);
$this->assertFalse($user->fresh()->hasVerifiedEmail());
@@ -97,6 +97,34 @@ class EmailVerificationTest extends TestCase
$response->assertRedirect(route('dashboard', absolute: false));
}
public function test_the_ui_rework_preserves_the_existing_optional_verification_policy(): void
{
$user = User::factory()->unverified()->create();
$this->actingAs($user)->get(route('dashboard'))->assertOk();
$this->assertFalse($user->fresh()->hasVerifiedEmail());
}
public function test_guests_cannot_view_the_verification_prompt(): void
{
$this->get(route('verification.notice'))->assertRedirect(route('login'));
}
public function test_expired_verification_links_cannot_verify_an_email(): void
{
$user = User::factory()->unverified()->create();
$verificationUrl = URL::temporarySignedRoute(
'verification.verify',
now()->subMinute(),
['id' => $user->id, 'hash' => sha1($user->email)],
);
$this->actingAs($user)->get($verificationUrl)->assertForbidden();
$this->assertFalse($user->fresh()->hasVerifiedEmail());
}
public function test_already_verified_user_visiting_verification_link_is_redirected_without_firing_event_again(): void
{
$user = User::factory()->create();