Support register-user-profile.ftl

This commit is contained in:
garronej
2021-10-11 03:25:02 +02:00
parent c388c77f4a
commit 4ca2bc59b6
8 changed files with 346 additions and 128 deletions

View File

@ -13,7 +13,7 @@ type ExtractAfterStartingWith<Prefix extends string, StrEnum> =
* (ex: url.loginAction is undefined on error.ftl)
*/
export type KcContextBase =
KcContextBase.Login | KcContextBase.Register | KcContextBase.Info |
KcContextBase.Login | KcContextBase.Register | KcContextBase.RegisterUserProfile | KcContextBase.Info |
KcContextBase.Error | KcContextBase.LoginResetPassword | KcContextBase.LoginVerifyEmail |
KcContextBase.Terms | KcContextBase.LoginOtp | KcContextBase.LoginUpdateProfile |
KcContextBase.LoginIdpLinkConfirm;
@ -62,6 +62,12 @@ export declare namespace KcContextBase {
name?: string;
}
isAppInitiatedAction: boolean;
messagesPerField: {
printIfExists: <T>(fieldName: string, x: T) => T | undefined;
existsError: (fieldName: string) => boolean;
get: (fieldName: string) => string;
exists: (fieldName: string) => boolean;
};
};
export type Login = Common & {
@ -97,35 +103,10 @@ export declare namespace KcContextBase {
};
};
export type Register = Common & {
pageId: "register.ftl";
export type RegisterCommon = Common & {
url: {
registrationAction: string;
};
messagesPerField: {
printIfExists: <T>(
key:
"userLabel" |
"username" |
"email" |
"firstName" |
"lastName" |
"password" |
"password-confirm",
x: T
)=> T | undefined;
existsError: (key: string)=> boolean;
get: (key: string) => string;
};
register: {
formData: {
firstName?: string;
displayName?: string;
lastName?: string;
email?: string;
username?: string;
}
};
passwordRequired: boolean;
recaptchaRequired: boolean;
recaptchaSiteKey?: string;
@ -140,6 +121,37 @@ export declare namespace KcContextBase {
};
};
export type Register = RegisterCommon & {
pageId: "register.ftl";
register: {
formData: {
firstName?: string;
displayName?: string;
lastName?: string;
email?: string;
username?: string;
}
};
};
export type RegisterUserProfile = RegisterCommon & {
pageId: "register-user-profile.ftl";
profile: {
attributes: {
name: string;
displayName?: string;
required: boolean;
value?: string;
group?: string;
groupDisplayHeader?: string;
groupDisplayDescription?: string;
readOnly: boolean;
autocomplete?: string;
}[];
}
};
export type Info = Common & {
pageId: "info.ftl";
messageHeader?: string;
@ -191,13 +203,6 @@ export declare namespace KcContextBase {
firstName?: string;
lastName?: string;
};
messagesPerField: {
printIfExists<T>(
key: "username" | "email" | "firstName" | "lastName",
x: T
): T | undefined;
};
};
export type LoginIdpLinkConfirm = Common & {