checkpoint update on useFormValidation

This commit is contained in:
Joseph Garrone 2024-04-20 22:12:39 +02:00
parent f6bdd92f9e
commit f1a0887e9b

View File

@ -21,8 +21,8 @@ export function useFormValidation(params: {
passwordRequired?: boolean;
realm: { registrationEmailAsUsername: boolean };
};
/** NOTE: Try to avoid passing a new ref every render for better performances. */
passwordValidators?: Validators;
//TODO: Add a param that enable not to use password confirmation
i18n: I18n;
}) {
const { kcContext, passwordValidators = {}, i18n } = params;
@ -48,8 +48,10 @@ export function useFormValidation(params: {
"readOnly": false,
"validators": passwordValidators,
"annotations": {},
"groupAnnotations": {},
"autocomplete": "new-password"
"autocomplete": "new-password",
"html5DataAnnotations": {},
// NOTE: Compat with Keycloak version prior to 24
...({ "groupAnnotations": {} } as {})
}),
id<Attribute>({
"name": "password-confirm",
@ -65,15 +67,17 @@ export function useFormValidation(params: {
}
},
"annotations": {},
"groupAnnotations": {},
"autocomplete": "new-password"
"html5DataAnnotations": {},
"autocomplete": "new-password",
// NOTE: Compat with Keycloak version prior to 24
...({ "groupAnnotations": {} } as {})
})
])
],
[]
);
})(),
[kcContext, passwordValidators]
[kcContext, JSON.stringify(passwordValidators)]
);
const { getErrors } = useGetErrors({