From 494f07baf378e308397830d375feb5c2d01f1120 Mon Sep 17 00:00:00 2001 From: guillaume-peoch-sonarsource Date: Tue, 10 Sep 2024 10:53:19 +0200 Subject: [PATCH] SONAR-22931 Clear confirm password when password is empty --- .../src/main/js/components/common/UserPasswordInput.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/sonar-web/src/main/js/components/common/UserPasswordInput.tsx b/server/sonar-web/src/main/js/components/common/UserPasswordInput.tsx index 1bced367dcd..25fe0037d02 100644 --- a/server/sonar-web/src/main/js/components/common/UserPasswordInput.tsx +++ b/server/sonar-web/src/main/js/components/common/UserPasswordInput.tsx @@ -54,6 +54,12 @@ export default function UserPasswordInput(props: Readonly) { const passwordMatch = isPasswordConfirmed(value, confirmValue); const passwordDontMatch = value !== confirmValue && confirmValue !== ''; + React.useEffect(() => { + if (value === '') { + setConfirmValue(''); + } + }, [value]); + return ( <> setIsFocused(false)}> -- 2.39.5