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