]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-22931 Clear confirm password when password is empty
authorguillaume-peoch-sonarsource <guillaume.peoch@sonarsource.com>
Tue, 10 Sep 2024 08:53:19 +0000 (10:53 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 11 Sep 2024 20:03:48 +0000 (20:03 +0000)
server/sonar-web/src/main/js/components/common/UserPasswordInput.tsx

index 1bced367dcd934c22796518d84677c6749b5a7fc..25fe0037d02d05a2a0d7f2699458052fa8b0dbe4 100644 (file)
@@ -54,6 +54,12 @@ export default function UserPasswordInput(props: Readonly<Props>) {
   const passwordMatch = isPasswordConfirmed(value, confirmValue);
   const passwordDontMatch = value !== confirmValue && confirmValue !== '';
 
+  React.useEffect(() => {
+    if (value === '') {
+      setConfirmValue('');
+    }
+  }, [value]);
+
   return (
     <>
       <FocusOutHandler className="sw-flex sw-items-center" onFocusOut={() => setIsFocused(false)}>