From c0d127e4f46bbd7e2447643503a6035bf7d757a9 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Tue, 23 Jul 2024 14:58:39 +0200 Subject: [PATCH] #593 --- src/login/lib/useUserProfileForm.tsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/login/lib/useUserProfileForm.tsx b/src/login/lib/useUserProfileForm.tsx index e960cb9d..805ff6b9 100644 --- a/src/login/lib/useUserProfileForm.tsx +++ b/src/login/lib/useUserProfileForm.tsx @@ -429,6 +429,28 @@ export function useUserProfileForm(params: UseUserProfileFormParams): ReturnType }); } + trigger_password_confirm_validation_on_password_change: { + if (!doMakeUserConfirmPassword) { + break trigger_password_confirm_validation_on_password_change; + } + + if (formAction.name !== "password") { + break trigger_password_confirm_validation_on_password_change; + } + + state = reducer(state, { + action: "update", + name: "password-confirm", + valueOrValues: (() => { + const formFieldState = state.formFieldStates.find(({ attribute }) => attribute.name === "password-confirm"); + + assert(formFieldState !== undefined); + + return formFieldState.valueOrValues; + })() + }); + } + return; case "focus lost": if (formFieldState.hasLostFocusAtLeastOnce instanceof Array) {