From 704dd6c26e8524d81d62dedeb2def3e3ef616e41 Mon Sep 17 00:00:00 2001 From: Koda Date: Fri, 22 May 2026 21:10:14 +0000 Subject: [PATCH] Polish forced password change flow --- .../Settings/PasswordUpdateRequest.php | 14 +++++++- .../js/pages/auth/ForcePasswordChange.vue | 13 ++++++- tests/Feature/Settings/SecurityTest.php | 36 +++++++++++++++++++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/app/Http/Requests/Settings/PasswordUpdateRequest.php b/app/Http/Requests/Settings/PasswordUpdateRequest.php index 0e5ff2f..6536ae5 100644 --- a/app/Http/Requests/Settings/PasswordUpdateRequest.php +++ b/app/Http/Requests/Settings/PasswordUpdateRequest.php @@ -19,7 +19,19 @@ class PasswordUpdateRequest extends FormRequest { return [ 'current_password' => $this->currentPasswordRules(), - 'password' => $this->passwordRules(), + 'password' => [...$this->passwordRules(), 'different:current_password'], + ]; + } + + /** + * Get the custom validation messages for the request. + * + * @return array + */ + public function messages(): array + { + return [ + 'password.different' => 'The new password must be different from your current password.', ]; } } diff --git a/resources/js/pages/auth/ForcePasswordChange.vue b/resources/js/pages/auth/ForcePasswordChange.vue index 9c27640..29f9e79 100644 --- a/resources/js/pages/auth/ForcePasswordChange.vue +++ b/resources/js/pages/auth/ForcePasswordChange.vue @@ -1,5 +1,6 @@