Dot not create fake attribute field, hide password confirm at an higher level
This commit is contained in:
parent
8030bf42ff
commit
f09ea971cf
@ -540,12 +540,6 @@ export type Attribute = {
|
||||
validators: Validators;
|
||||
annotations: Record<string, string>;
|
||||
multivalued?: boolean;
|
||||
/**
|
||||
* NOTE: This is not a Keycloak attribute, it's a Keycloakify addition.
|
||||
* usecase is to enable to hide the password confirmation if the theme is configured like that.
|
||||
* SEE: https://github.com/keycloakify/keycloakify/issues/238#issuecomment-1874605774
|
||||
*/
|
||||
hidden?: boolean;
|
||||
autocomplete?:
|
||||
| "on"
|
||||
| "off"
|
||||
|
@ -56,14 +56,14 @@ export type KcContextLike = {
|
||||
passwordPolicies?: PasswordPolicies;
|
||||
};
|
||||
|
||||
export type ParamsOfUseProfileAttributeForm = {
|
||||
export type ParamsOfUseUserProfileForm = {
|
||||
kcContext: KcContextLike;
|
||||
passwordValidators?: Validators;
|
||||
requirePasswordConfirmation?: boolean;
|
||||
i18n: I18n;
|
||||
};
|
||||
|
||||
export type ReturnTypeOfUseProfileAttributeForm = {
|
||||
export type ReturnTypeOfUseUserProfileForm = {
|
||||
formState: FormState;
|
||||
dispatchFormAction: Dispatch<FormAction>;
|
||||
attributesWithPassword: Attribute[];
|
||||
@ -73,8 +73,8 @@ export type ReturnTypeOfUseProfileAttributeForm = {
|
||||
* NOTE: The attributesWithPassword returned is actually augmented with
|
||||
* artificial password related attributes only if kcContext.passwordRequired === true
|
||||
*/
|
||||
export function useUserProfileForm(params: ParamsOfUseProfileAttributeForm): ReturnTypeOfUseProfileAttributeForm {
|
||||
const { kcContext, passwordValidators = {}, requirePasswordConfirmation = true, i18n } = params;
|
||||
export function useUserProfileForm(params: ParamsOfUseUserProfileForm): ReturnTypeOfUseUserProfileForm {
|
||||
const { kcContext, passwordValidators = {}, i18n } = params;
|
||||
|
||||
const attributesWithPassword = useMemo(() => {
|
||||
const attributesWithPassword: Attribute[] = [];
|
||||
@ -118,7 +118,6 @@ export function useUserProfileForm(params: ParamsOfUseProfileAttributeForm): Ret
|
||||
"annotations": {},
|
||||
"html5DataAnnotations": {},
|
||||
"autocomplete": "new-password",
|
||||
"hidden": !requirePasswordConfirmation,
|
||||
// NOTE: Compat with Keycloak version prior to 24
|
||||
...({ "groupAnnotations": {} } as {})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user