feat(KAN-21): rebuild login verification and two-factor flows
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user