Auth: convert auth views and verification email to Nova layout

This commit is contained in:
2026-02-21 07:37:08 +01:00
parent 93b009d42a
commit 795c7a835f
117 changed files with 5385 additions and 1291 deletions

View File

@@ -0,0 +1,60 @@
<?php
use App\Mail\RegistrationVerificationMail;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Mail;
uses(RefreshDatabase::class);
it('shows registration notice with email after first step', function () {
Mail::fake();
$this->post('/register', [
'email' => 'notice@example.com',
])->assertRedirect('/register/notice');
$this->get('/register/notice')
->assertOk()
->assertSee('notice@example.com')
->assertSee('Change email');
});
it('prefills register form email from query string', function () {
$this->get('/register?email=prefill@example.com')
->assertOk()
->assertSee('value="prefill@example.com"', false);
});
it('blocks resend while cooldown is active', function () {
Mail::fake();
$this->post('/register', [
'email' => 'cooldown@example.com',
])->assertRedirect('/register/notice');
$this->from('/register/notice')->post('/register/resend-verification', [
'email' => 'cooldown@example.com',
])->assertRedirect('/register/notice')
->assertSessionHasErrors('email');
});
it('resends verification after cooldown expires', function () {
Mail::fake();
$this->post('/register', [
'email' => 'resend@example.com',
])->assertRedirect('/register/notice');
$key = 'register:resend:cooldown:' . sha1('resend@example.com');
Cache::forget($key);
$this->post('/register/resend-verification', [
'email' => 'resend@example.com',
])->assertRedirect('/register/notice');
Mail::assertQueued(RegistrationVerificationMail::class, 2);
expect(User::query()->where('email', 'resend@example.com')->exists())->toBeTrue();
});