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,62 @@
<?php
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Hash;
uses(RefreshDatabase::class);
it('requires authentication to open setup password screen', function () {
$this->get('/setup/password')
->assertRedirect('/login');
});
it('renders setup password screen for authenticated user', function () {
$user = User::factory()->create([
'onboarding_step' => 'verified',
'needs_password_reset' => true,
]);
$this->actingAs($user)
->get('/setup/password')
->assertOk();
});
it('accepts strong password and moves onboarding to password step', function () {
$user = User::factory()->create([
'onboarding_step' => 'verified',
'needs_password_reset' => true,
'password' => Hash::make('old-password'),
]);
$response = $this->actingAs($user)
->post('/setup/password', [
'password' => 'StrongPass1!',
'password_confirmation' => 'StrongPass1!',
]);
$response->assertRedirect('/setup/username');
$user->refresh();
expect(Hash::check('StrongPass1!', $user->password))->toBeTrue();
expect($user->onboarding_step)->toBe('password');
expect((bool) $user->needs_password_reset)->toBeFalse();
});
it('rejects password without number or symbol or minimum length', function () {
$user = User::factory()->create([
'onboarding_step' => 'verified',
'needs_password_reset' => true,
]);
$this->actingAs($user)
->from('/setup/password')
->post('/setup/password', [
'password' => 'weakpass',
'password_confirmation' => 'weakpass',
])
->assertRedirect('/setup/password')
->assertSessionHasErrors('password');
expect($user->fresh()->onboarding_step)->toBe('verified');
});