Polish forced password change flow
This commit is contained in:
@@ -109,6 +109,20 @@ class SecurityTest extends TestCase
|
||||
$this->actingAs($user)
|
||||
->get(route('password.force-change.edit'))
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('auth/ForcePasswordChange')
|
||||
->where('status', null),
|
||||
);
|
||||
}
|
||||
|
||||
public function test_forced_password_change_page_exposes_a_logout_action()
|
||||
{
|
||||
$user = User::factory()->create([
|
||||
'must_change_password_on_next_login' => true,
|
||||
]);
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('password.force-change.edit'))
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('auth/ForcePasswordChange'),
|
||||
);
|
||||
@@ -213,4 +227,26 @@ class SecurityTest extends TestCase
|
||||
->assertSessionHasErrors('current_password')
|
||||
->assertRedirect(route('security.edit'));
|
||||
}
|
||||
|
||||
public function test_new_password_must_be_different_from_the_current_password()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$response = $this
|
||||
->actingAs($user)
|
||||
->from(route('security.edit'))
|
||||
->put(route('user-password.update'), [
|
||||
'current_password' => 'password',
|
||||
'password' => 'password',
|
||||
'password_confirmation' => 'password',
|
||||
]);
|
||||
|
||||
$response
|
||||
->assertSessionHasErrors([
|
||||
'password' => 'The new password must be different from your current password.',
|
||||
])
|
||||
->assertRedirect(route('security.edit'));
|
||||
|
||||
$this->assertTrue(Hash::check('password', $user->fresh()->password));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user