feat(profile): align settings with dashboard layout
This commit is contained in:
@@ -48,22 +48,22 @@ function enableTwoFactorForTest(User $user): array
|
||||
];
|
||||
}
|
||||
|
||||
it('keeps the profile available while two-factor settings are disabled', function () {
|
||||
it('keeps profile security available while two-factor settings are disabled', function () {
|
||||
config(['auth-ui.features.two_factor' => false]);
|
||||
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get('/profile')
|
||||
->get('/profile/security')
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Profile/Show')
|
||||
->component('Profile/Security')
|
||||
->where('twoFactor.available', false)
|
||||
->where('twoFactor.enabled', false)
|
||||
->where('twoFactor.pending', false));
|
||||
});
|
||||
|
||||
it('redirects the former security page to the profile', function () {
|
||||
it('redirects the former security page to profile security', function () {
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get('/security')
|
||||
->assertRedirect('/profile');
|
||||
->assertRedirect('/profile/security');
|
||||
});
|
||||
|
||||
it('bypasses stored two-factor configuration when the feature is disabled', function () {
|
||||
@@ -248,15 +248,15 @@ it('requires the current password before a password user can enroll', function (
|
||||
|
||||
$this->actingAs($user)
|
||||
->post('/profile/two-factor', ['password' => 'password123'])
|
||||
->assertRedirect('/profile');
|
||||
->assertRedirect('/profile/security');
|
||||
|
||||
expect($user->fresh()->two_factor_secret)->not->toBeNull()
|
||||
->and($user->fresh()->two_factor_confirmed_at)->toBeNull();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get('/profile')
|
||||
->get('/profile/security')
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('Profile/Show')
|
||||
->component('Profile/Security')
|
||||
->where('twoFactor.pending', true)
|
||||
->where('twoFactor.enabled', false)
|
||||
->where('twoFactor.requiresPassword', true)
|
||||
@@ -274,7 +274,7 @@ it('confirms enrollment and returns recovery codes once', function () {
|
||||
|
||||
$this->actingAs($user)
|
||||
->post('/profile/two-factor/confirm', ['code' => $code])
|
||||
->assertRedirect('/profile')
|
||||
->assertRedirect('/profile/security')
|
||||
->assertSessionHas('recoveryCodes', fn (array $codes) => count($codes) === 8);
|
||||
|
||||
expect($user->fresh()->hasEnabledTwoFactorAuthentication())->toBeTrue();
|
||||
@@ -366,7 +366,7 @@ it('requires a valid second factor for social-only users to disable protection',
|
||||
|
||||
$this->actingAs($user)
|
||||
->delete('/profile/two-factor', ['code' => $twoFactor['code']])
|
||||
->assertRedirect('/profile');
|
||||
->assertRedirect('/profile/security');
|
||||
|
||||
expect($user->fresh()->hasEnabledTwoFactorAuthentication())->toBeFalse();
|
||||
});
|
||||
@@ -387,7 +387,7 @@ it('requires both password and second factor for password users to disable prote
|
||||
'password' => 'password123',
|
||||
'code' => $twoFactor['code'],
|
||||
])
|
||||
->assertRedirect('/profile');
|
||||
->assertRedirect('/profile/security');
|
||||
|
||||
expect($user->fresh()->hasEnabledTwoFactorAuthentication())->toBeFalse();
|
||||
Notification::assertSentTo($user, TwoFactorSecurityNotification::class);
|
||||
@@ -410,7 +410,7 @@ it('requires both password and second factor to reveal recovery codes', function
|
||||
'code' => $twoFactor['code'],
|
||||
'regenerate' => false,
|
||||
])
|
||||
->assertRedirect('/profile')
|
||||
->assertRedirect('/profile/security')
|
||||
->assertSessionHas('recoveryCodes');
|
||||
});
|
||||
|
||||
@@ -469,7 +469,7 @@ it('consumes recovery codes used to authorize a sensitive settings action', func
|
||||
'code' => $recoveryCode,
|
||||
'regenerate' => false,
|
||||
])
|
||||
->assertRedirect('/profile')
|
||||
->assertRedirect('/profile/security')
|
||||
->assertSessionHas('recoveryCodes');
|
||||
|
||||
expect($user->fresh()->recoveryCodes())->not->toContain($recoveryCode);
|
||||
|
||||
Reference in New Issue
Block a user