From 57932386bff6bb41dff58e154a098d9e92239f15 Mon Sep 17 00:00:00 2001 From: garronej Date: Tue, 12 Oct 2021 02:09:09 +0200 Subject: [PATCH] register-user-profile.ftl tested working --- src/lib/components/RegisterUserProfile.tsx | 19 ++++++------------- .../kcContextMocks/kcContextMocks.ts | 3 +-- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/lib/components/RegisterUserProfile.tsx b/src/lib/components/RegisterUserProfile.tsx index 8a450867..c88a6f87 100644 --- a/src/lib/components/RegisterUserProfile.tsx +++ b/src/lib/components/RegisterUserProfile.tsx @@ -68,6 +68,7 @@ export const RegisterUserProfile = memo(({ kcContext, ...props }: { kcContext: K id="password-confirm" className={cx(props.kcInputClass)} name="password-confirm" + autoComplete="new-password" aria-invalid={messagesPerField.existsError("password-confirm")} /> {messagesPerField.existsError("password-confirm") && ( @@ -141,18 +142,11 @@ const UserProfileFormFields = memo( return ( <> - {kcContext.profile.attributes.map((attribute, i) => { - const { group = "", groupDisplayHeader = "", groupDisplayDescription = "" } = attribute; - - console.log(JSON.stringify(attribute, null, 2)); - - //if (group === currentGroup) return null; - - currentGroup = group; - - return ( + {kcContext.profile.attributes + .map(attribute => [attribute, attribute]) + .map(([attribute, { group = "", groupDisplayHeader = "", groupDisplayDescription = "" }], i) => ( - {group !== "" && ( + {group !== currentGroup && (currentGroup = group) !== "" && (
- ); - })} + ))} ); }, diff --git a/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts b/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts index 59c81394..fdbae7ee 100644 --- a/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts +++ b/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts @@ -21,7 +21,7 @@ export const kcContextCommonMock: KcContextBase.Common = { "displayName": "myrealm", "displayNameHtml": "myrealm", "internationalizationEnabled": true, - "registrationEmailAsUsername": true, + "registrationEmailAsUsername": false, }, "messagesPerField": { "printIfExists": (...[, x]) => x, @@ -185,7 +185,6 @@ export const kcContextMocks: KcContextBase[] = [ id({ "pageId": "register-user-profile.ftl", ...registerCommon, - "profile": { "context": "REGISTRATION_PROFILE" as const, ...(() => {