@oussemasahbeni/keycloakify-login-shadcn 250004.0.3 → 250004.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/keycloak-theme/components/langauges.tsx +1 -1
- package/keycloak-theme/components/theme-toggle.tsx +0 -1
- package/keycloak-theme/components/ui/alert.tsx +1 -2
- package/keycloak-theme/components/ui/button.tsx +1 -2
- package/keycloak-theme/components/ui/card.tsx +0 -1
- package/keycloak-theme/components/ui/checkbox.tsx +0 -1
- package/keycloak-theme/components/ui/dropdown-menu.tsx +14 -4
- package/keycloak-theme/components/ui/field.tsx +0 -1
- package/keycloak-theme/components/ui/input-otp.tsx +0 -1
- package/keycloak-theme/components/ui/input.tsx +0 -1
- package/keycloak-theme/components/ui/label.tsx +1 -2
- package/keycloak-theme/components/ui/radio-group.tsx +0 -1
- package/keycloak-theme/components/ui/select.tsx +12 -4
- package/keycloak-theme/components/ui/separator.tsx +0 -1
- package/keycloak-theme/components/ui/tooltip.tsx +0 -1
- package/keycloak-theme/login/KcContext.ts +23 -23
- package/keycloak-theme/login/KcPage.tsx +45 -47
- package/keycloak-theme/login/assets/img/auth-logo.svg +100 -100
- package/keycloak-theme/login/assets/img/shape.svg +71 -71
- package/keycloak-theme/login/components/LogoutOtherSessions.tsx +24 -26
- package/keycloak-theme/login/components/PasswordWrapper.tsx +35 -35
- package/keycloak-theme/login/components/Template/Template.tsx +279 -227
- package/keycloak-theme/login/components/Template/index.ts +1 -1
- package/keycloak-theme/login/components/Template/useInitializeTemplate.ts +61 -61
- package/keycloak-theme/login/components/UserProfileFormFields/AddRemoveButtonsMultiValuedAttribute.tsx +65 -61
- package/keycloak-theme/login/components/UserProfileFormFields/DO_MAKE_USER_CONFIRM_PASSWORD.ts +2 -2
- package/keycloak-theme/login/components/UserProfileFormFields/FieldErrors.tsx +33 -29
- package/keycloak-theme/login/components/UserProfileFormFields/GroupLabel.tsx +90 -71
- package/keycloak-theme/login/components/UserProfileFormFields/InputFieldByType.tsx +66 -59
- package/keycloak-theme/login/components/UserProfileFormFields/InputLabel.tsx +0 -1
- package/keycloak-theme/login/components/UserProfileFormFields/InputTag.tsx +133 -116
- package/keycloak-theme/login/components/UserProfileFormFields/InputTagSelects.tsx +150 -136
- package/keycloak-theme/login/components/UserProfileFormFields/SelectTag.tsx +135 -114
- package/keycloak-theme/login/components/UserProfileFormFields/TextareaTag.tsx +55 -43
- package/keycloak-theme/login/components/UserProfileFormFields/UserProfileFormFields.tsx +133 -127
- package/keycloak-theme/login/components/UserProfileFormFields/index.ts +1 -1
- package/keycloak-theme/login/i18n.ts +47 -47
- package/keycloak-theme/login/mocks/KcPageStory.tsx +6 -2
- package/keycloak-theme/login/mocks/getKcContextMock.ts +22 -22
- package/keycloak-theme/login/pages/PageIndex.tsx +130 -134
- package/keycloak-theme/login/pages/code/Page.stories.tsx +57 -70
- package/keycloak-theme/login/pages/code/Page.tsx +89 -89
- package/keycloak-theme/login/pages/code/index.ts +3 -3
- package/keycloak-theme/login/pages/delete-account-confirm/Page.stories.tsx +37 -46
- package/keycloak-theme/login/pages/delete-account-confirm/Page.tsx +60 -63
- package/keycloak-theme/login/pages/delete-account-confirm/index.ts +3 -3
- package/keycloak-theme/login/pages/delete-credential/Page.stories.tsx +25 -30
- package/keycloak-theme/login/pages/delete-credential/Page.tsx +56 -51
- package/keycloak-theme/login/pages/delete-credential/index.ts +3 -3
- package/keycloak-theme/login/pages/error/Page.stories.tsx +46 -58
- package/keycloak-theme/login/pages/error/Page.tsx +43 -42
- package/keycloak-theme/login/pages/error/index.ts +3 -3
- package/keycloak-theme/login/pages/frontchannel-logout/Page.stories.tsx +25 -32
- package/keycloak-theme/login/pages/frontchannel-logout/Page.tsx +82 -84
- package/keycloak-theme/login/pages/frontchannel-logout/index.ts +3 -3
- package/keycloak-theme/login/pages/idp-review-user-profile/Page.stories.tsx +46 -59
- package/keycloak-theme/login/pages/idp-review-user-profile/Page.tsx +49 -52
- package/keycloak-theme/login/pages/idp-review-user-profile/index.ts +3 -3
- package/keycloak-theme/login/pages/info/Page.stories.tsx +50 -60
- package/keycloak-theme/login/pages/info/Page.tsx +94 -92
- package/keycloak-theme/login/pages/link-idp-action/Page.stories.tsx +32 -16
- package/keycloak-theme/login/pages/link-idp-action/Page.tsx +45 -43
- package/keycloak-theme/login/pages/link-idp-action/index.ts +3 -3
- package/keycloak-theme/login/pages/login/Form.tsx +242 -242
- package/keycloak-theme/login/pages/login/Info.tsx +29 -29
- package/keycloak-theme/login/pages/login/Page.stories.tsx +346 -365
- package/keycloak-theme/login/pages/login/Page.tsx +43 -44
- package/keycloak-theme/login/pages/login/SocialProviders.tsx +93 -107
- package/keycloak-theme/login/pages/login/index.ts +3 -3
- package/keycloak-theme/login/pages/login/providers/apple.svg +3 -3
- package/keycloak-theme/login/pages/login/providers/bitbucket.svg +11 -11
- package/keycloak-theme/login/pages/login/providers/discord.svg +4 -4
- package/keycloak-theme/login/pages/login/providers/facebook.svg +5 -5
- package/keycloak-theme/login/pages/login/providers/github.svg +3 -3
- package/keycloak-theme/login/pages/login/providers/gitlab.svg +7 -7
- package/keycloak-theme/login/pages/login/providers/google.svg +7 -7
- package/keycloak-theme/login/pages/login/providers/instagram.svg +31 -31
- package/keycloak-theme/login/pages/login/providers/linkedin.svg +3 -3
- package/keycloak-theme/login/pages/login/providers/microsoft.svg +6 -6
- package/keycloak-theme/login/pages/login/providers/oidc.svg +5 -5
- package/keycloak-theme/login/pages/login/providers/openshift.svg +7 -7
- package/keycloak-theme/login/pages/login/providers/paypal.svg +6 -6
- package/keycloak-theme/login/pages/login/providers/slack.svg +11 -11
- package/keycloak-theme/login/pages/login/providers/stackoverflow.svg +5 -5
- package/keycloak-theme/login/pages/login/providers/x.svg +3 -3
- package/keycloak-theme/login/pages/login/useProviderLogos.tsx +39 -39
- package/keycloak-theme/login/pages/login/useScript.tsx +62 -62
- package/keycloak-theme/login/pages/login-config-totp/Page.stories.tsx +45 -60
- package/keycloak-theme/login/pages/login-config-totp/Page.tsx +253 -240
- package/keycloak-theme/login/pages/login-config-totp/index.ts +3 -3
- package/keycloak-theme/login/pages/login-idp-link-confirm/Page.stories.tsx +30 -35
- package/keycloak-theme/login/pages/login-idp-link-confirm/Page.tsx +40 -43
- package/keycloak-theme/login/pages/login-idp-link-confirm/index.ts +3 -3
- package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.stories.tsx +16 -23
- package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.tsx +44 -47
- package/keycloak-theme/login/pages/login-idp-link-confirm-override/index.ts +3 -3
- package/keycloak-theme/login/pages/login-idp-link-email/Page.stories.tsx +54 -63
- package/keycloak-theme/login/pages/login-idp-link-email/Page.tsx +51 -54
- package/keycloak-theme/login/pages/login-idp-link-email/index.ts +3 -3
- package/keycloak-theme/login/pages/login-oauth-grant/Page.stories.tsx +39 -45
- package/keycloak-theme/login/pages/login-oauth-grant/Page.tsx +136 -126
- package/keycloak-theme/login/pages/login-oauth-grant/index.ts +3 -3
- package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/Page.stories.tsx +38 -48
- package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/Page.tsx +56 -58
- package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/index.ts +3 -3
- package/keycloak-theme/login/pages/login-otp/Page.stories.tsx +82 -97
- package/keycloak-theme/login/pages/login-otp/Page.tsx +117 -108
- package/keycloak-theme/login/pages/login-otp/index.ts +3 -3
- package/keycloak-theme/login/pages/login-page-expired/Page.stories.tsx +28 -37
- package/keycloak-theme/login/pages/login-page-expired/Page.tsx +45 -47
- package/keycloak-theme/login/pages/login-page-expired/index.ts +3 -3
- package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/Page.stories.tsx +20 -0
- package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/Page.tsx +290 -233
- package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/index.ts +3 -3
- package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/useScript.tsx +63 -63
- package/keycloak-theme/login/pages/login-password/Page.stories.tsx +55 -56
- package/keycloak-theme/login/pages/login-password/Page.tsx +148 -149
- package/keycloak-theme/login/pages/login-password/index.ts +3 -3
- package/keycloak-theme/login/pages/login-password/useScript.tsx +62 -63
- package/keycloak-theme/login/pages/login-recovery-authn-code-config/Page.stories.tsx +28 -36
- package/keycloak-theme/login/pages/login-recovery-authn-code-config/Page.tsx +178 -181
- package/keycloak-theme/login/pages/login-recovery-authn-code-config/index.ts +3 -3
- package/keycloak-theme/login/pages/login-recovery-authn-code-config/useScript.tsx +145 -145
- package/keycloak-theme/login/pages/login-recovery-authn-code-input/Page.stories.tsx +16 -22
- package/keycloak-theme/login/pages/login-recovery-authn-code-input/Page.tsx +69 -70
- package/keycloak-theme/login/pages/login-recovery-authn-code-input/index.ts +3 -3
- package/keycloak-theme/login/pages/login-reset-otp/Page.stories.tsx +62 -75
- package/keycloak-theme/login/pages/login-reset-otp/Page.tsx +85 -86
- package/keycloak-theme/login/pages/login-reset-otp/index.ts +3 -3
- package/keycloak-theme/login/pages/login-reset-password/Form.tsx +67 -68
- package/keycloak-theme/login/pages/login-reset-password/Page.stories.tsx +44 -55
- package/keycloak-theme/login/pages/login-reset-password/Page.tsx +27 -27
- package/keycloak-theme/login/pages/login-reset-password/index.ts +3 -3
- package/keycloak-theme/login/pages/login-update-password/Page.stories.tsx +40 -51
- package/keycloak-theme/login/pages/login-update-password/Page.tsx +109 -111
- package/keycloak-theme/login/pages/login-update-password/index.ts +3 -3
- package/keycloak-theme/login/pages/login-update-profile/Page.stories.tsx +28 -37
- package/keycloak-theme/login/pages/login-update-profile/Page.tsx +67 -68
- package/keycloak-theme/login/pages/login-update-profile/index.ts +3 -3
- package/keycloak-theme/login/pages/login-username/Page.stories.tsx +32 -43
- package/keycloak-theme/login/pages/login-username/Page.tsx +246 -246
- package/keycloak-theme/login/pages/login-username/index.ts +3 -3
- package/keycloak-theme/login/pages/login-username/useScript.tsx +62 -62
- package/keycloak-theme/login/pages/login-verify-email/Page.stories.tsx +68 -81
- package/keycloak-theme/login/pages/login-verify-email/Page.tsx +37 -38
- package/keycloak-theme/login/pages/login-verify-email/index.ts +3 -3
- package/keycloak-theme/login/pages/login-x509-info/Page.stories.tsx +29 -38
- package/keycloak-theme/login/pages/login-x509-info/Page.tsx +72 -75
- package/keycloak-theme/login/pages/login-x509-info/index.ts +3 -3
- package/keycloak-theme/login/pages/logout-confirm/Page.stories.tsx +34 -43
- package/keycloak-theme/login/pages/logout-confirm/Page.tsx +50 -53
- package/keycloak-theme/login/pages/logout-confirm/index.ts +3 -3
- package/keycloak-theme/login/pages/register/Form.tsx +107 -106
- package/keycloak-theme/login/pages/register/Page.stories.tsx +40 -14
- package/keycloak-theme/login/pages/register/Page.tsx +26 -26
- package/keycloak-theme/login/pages/register/TermsAcceptance.tsx +55 -56
- package/keycloak-theme/login/pages/register/index.ts +3 -3
- package/keycloak-theme/login/pages/saml-post-form/Page.stories.tsx +16 -23
- package/keycloak-theme/login/pages/saml-post-form/Page.tsx +64 -66
- package/keycloak-theme/login/pages/saml-post-form/index.ts +3 -3
- package/keycloak-theme/login/pages/select-authenticator/Page.stories.tsx +83 -96
- package/keycloak-theme/login/pages/select-authenticator/Page.tsx +97 -100
- package/keycloak-theme/login/pages/select-authenticator/index.ts +3 -3
- package/keycloak-theme/login/pages/select-organization/Page.stories.tsx +62 -49
- package/keycloak-theme/login/pages/select-organization/Page.tsx +123 -126
- package/keycloak-theme/login/pages/select-organization/index.ts +3 -3
- package/keycloak-theme/login/pages/terms/Page.stories.tsx +15 -0
- package/keycloak-theme/login/pages/terms/Page.tsx +49 -51
- package/keycloak-theme/login/pages/terms/index.ts +3 -3
- package/keycloak-theme/login/pages/update-email/Page.stories.tsx +27 -36
- package/keycloak-theme/login/pages/update-email/Page.tsx +61 -62
- package/keycloak-theme/login/pages/update-email/index.ts +3 -3
- package/keycloak-theme/login/pages/webauthn-authenticate/Page.stories.tsx +112 -127
- package/keycloak-theme/login/pages/webauthn-authenticate/Page.tsx +206 -202
- package/keycloak-theme/login/pages/webauthn-authenticate/index.ts +3 -3
- package/keycloak-theme/login/pages/webauthn-authenticate/useScript.tsx +55 -55
- package/keycloak-theme/login/pages/webauthn-error/Page.stories.tsx +52 -67
- package/keycloak-theme/login/pages/webauthn-error/Page.tsx +70 -73
- package/keycloak-theme/login/pages/webauthn-error/index.ts +3 -3
- package/keycloak-theme/login/pages/webauthn-register/Page.stories.tsx +39 -50
- package/keycloak-theme/login/pages/webauthn-register/Page.tsx +78 -78
- package/keycloak-theme/login/pages/webauthn-register/index.ts +3 -3
- package/keycloak-theme/login/pages/webauthn-register/useScript.tsx +62 -62
- package/keycloak-theme/login/shared/getColorScheme.ts +45 -45
- package/keycloak-theme/login/styleLevelCustomization.tsx +34 -36
- package/keycloak-theme/public/site.webmanifest +11 -1
- package/package.json +6 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createKcPageStory, type Meta, type StoryObj } from "../../mocks/KcPageStory";
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
const { KcPageStory } = createKcPageStory({ pageId: "logout-confirm.ftl" });
|
|
5
4
|
|
|
6
5
|
const meta = {
|
|
@@ -12,32 +11,26 @@ export default meta;
|
|
|
12
11
|
|
|
13
12
|
type Story = StoryObj<typeof meta>;
|
|
14
13
|
|
|
15
|
-
export const Default: Story = {
|
|
16
|
-
render: () => <KcPageStory />
|
|
17
|
-
};
|
|
14
|
+
export const Default: Story = {};
|
|
18
15
|
|
|
19
16
|
export const Arabic: Story = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/>
|
|
29
|
-
)
|
|
17
|
+
args: {
|
|
18
|
+
kcContext: {
|
|
19
|
+
locale: {
|
|
20
|
+
currentLanguageTag: "ar",
|
|
21
|
+
rtl: true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
30
25
|
};
|
|
31
26
|
export const French: Story = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/>
|
|
40
|
-
)
|
|
27
|
+
args: {
|
|
28
|
+
kcContext: {
|
|
29
|
+
locale: {
|
|
30
|
+
currentLanguageTag: "fr"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
41
34
|
};
|
|
42
35
|
|
|
43
36
|
/**
|
|
@@ -47,24 +40,22 @@ export const French: Story = {
|
|
|
47
40
|
* - Key Aspect: Ensures the custom logout message is displayed correctly.
|
|
48
41
|
*/
|
|
49
42
|
export const WithCustomLogoutMessage: Story = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/>
|
|
69
|
-
)
|
|
43
|
+
args: {
|
|
44
|
+
kcContext: {
|
|
45
|
+
url: {
|
|
46
|
+
logoutConfirmAction: "/mock-logout-action"
|
|
47
|
+
},
|
|
48
|
+
client: {
|
|
49
|
+
baseUrl: "/mock-client-url"
|
|
50
|
+
},
|
|
51
|
+
logoutConfirm: {
|
|
52
|
+
code: "mock-session-code",
|
|
53
|
+
skipLink: false
|
|
54
|
+
},
|
|
55
|
+
message: {
|
|
56
|
+
summary: "Are you sure you want to log out from all sessions?",
|
|
57
|
+
type: "warning"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
70
61
|
};
|
|
@@ -1,53 +1,50 @@
|
|
|
1
|
-
import { Button } from "@/components/ui/button";
|
|
2
|
-
import { useI18n } from
|
|
3
|
-
import { useKcContext } from
|
|
4
|
-
import { assert } from "tsafe/assert";
|
|
5
|
-
import { Template } from "../../components/Template";
|
|
6
|
-
|
|
7
|
-
export function Page() {
|
|
8
|
-
const { kcContext } = useKcContext();
|
|
9
|
-
assert(kcContext.pageId === "logout-confirm.ftl");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</Template>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
1
|
+
import { Button } from "@/components/ui/button";
|
|
2
|
+
import { useI18n } from "@/login/i18n";
|
|
3
|
+
import { useKcContext } from "@/login/KcContext";
|
|
4
|
+
import { assert } from "tsafe/assert";
|
|
5
|
+
import { Template } from "../../components/Template";
|
|
6
|
+
|
|
7
|
+
export function Page() {
|
|
8
|
+
const { kcContext } = useKcContext();
|
|
9
|
+
assert(kcContext.pageId === "logout-confirm.ftl");
|
|
10
|
+
|
|
11
|
+
const { url, client, logoutConfirm } = kcContext;
|
|
12
|
+
|
|
13
|
+
const { msg, msgStr } = useI18n();
|
|
14
|
+
return (
|
|
15
|
+
<Template headerNode={msg("logoutConfirmTitle")}>
|
|
16
|
+
<div className="space-y-4">
|
|
17
|
+
<p className="text-foreground ">{msg("logoutConfirmHeader")}</p>
|
|
18
|
+
|
|
19
|
+
<form
|
|
20
|
+
className="space-y-6"
|
|
21
|
+
action={url.logoutConfirmAction}
|
|
22
|
+
method="POST"
|
|
23
|
+
>
|
|
24
|
+
<input type="hidden" name="session_code" value={logoutConfirm.code} />
|
|
25
|
+
|
|
26
|
+
<Button
|
|
27
|
+
tabIndex={4}
|
|
28
|
+
className="w-full"
|
|
29
|
+
name="confirmLogout"
|
|
30
|
+
id="kc-logout"
|
|
31
|
+
type="submit"
|
|
32
|
+
>
|
|
33
|
+
{msgStr("doLogout")}
|
|
34
|
+
</Button>
|
|
35
|
+
</form>
|
|
36
|
+
|
|
37
|
+
{!logoutConfirm.skipLink && client.baseUrl && (
|
|
38
|
+
<div className="flex justify-end">
|
|
39
|
+
<a
|
|
40
|
+
href={client.baseUrl}
|
|
41
|
+
className="text-sm text-primary dark:text-white hover:text-primary/80 underline underline-offset-4"
|
|
42
|
+
>
|
|
43
|
+
{msg("backToApplication")}
|
|
44
|
+
</a>
|
|
45
|
+
</div>
|
|
46
|
+
)}
|
|
47
|
+
</div>
|
|
48
|
+
</Template>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Page } from "./Page";
|
|
2
|
-
|
|
3
|
-
export default Page;
|
|
1
|
+
import { Page } from "./Page";
|
|
2
|
+
|
|
3
|
+
export default Page;
|
|
@@ -1,106 +1,107 @@
|
|
|
1
|
-
import { Button } from
|
|
2
|
-
import { clsx } from "@keycloakify/login-ui/tools/clsx";
|
|
3
|
-
import { useKcClsx } from "@keycloakify/login-ui/useKcClsx";
|
|
4
|
-
import { useLayoutEffect, useState } from "react";
|
|
5
|
-
import { assert } from "tsafe/assert";
|
|
6
|
-
import { useKcContext } from "../../KcContext";
|
|
7
|
-
import { UserProfileFormFields } from "../../components/UserProfileFormFields";
|
|
8
|
-
import { useI18n } from "../../i18n";
|
|
9
|
-
import { TermsAcceptance } from "./TermsAcceptance";
|
|
10
|
-
|
|
11
|
-
export function Form() {
|
|
12
|
-
const { kcContext } = useKcContext();
|
|
13
|
-
assert(kcContext.pageId === "register.ftl");
|
|
14
|
-
const { kcClsx } = useKcClsx();
|
|
15
|
-
const { msg, msgStr } = useI18n();
|
|
16
|
-
|
|
17
|
-
const [isFormSubmittable, setIsFormSubmittable] = useState(false);
|
|
18
|
-
const [areTermsAccepted, setAreTermsAccepted] = useState(false);
|
|
19
|
-
|
|
20
|
-
useLayoutEffect(() => {
|
|
21
|
-
(window as any)["onSubmitRecaptcha"] = () => {
|
|
22
|
-
// @ts-expect-error
|
|
23
|
-
document.getElementById("kc-register-form").requestSubmit();
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return () => {
|
|
27
|
-
delete (window as any)["onSubmitRecaptcha"];
|
|
28
|
-
};
|
|
29
|
-
}, []);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<form
|
|
33
|
-
id="kc-register-form"
|
|
34
|
-
action={kcContext.url.registrationAction}
|
|
35
|
-
className="space-y-3"
|
|
36
|
-
method="post"
|
|
37
|
-
>
|
|
38
|
-
<UserProfileFormFields
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
data-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
1
|
+
import { Button } from "@/components/ui/button";
|
|
2
|
+
import { clsx } from "@keycloakify/login-ui/tools/clsx";
|
|
3
|
+
import { useKcClsx } from "@keycloakify/login-ui/useKcClsx";
|
|
4
|
+
import { useLayoutEffect, useState } from "react";
|
|
5
|
+
import { assert } from "tsafe/assert";
|
|
6
|
+
import { useKcContext } from "../../KcContext";
|
|
7
|
+
import { UserProfileFormFields } from "../../components/UserProfileFormFields";
|
|
8
|
+
import { useI18n } from "../../i18n";
|
|
9
|
+
import { TermsAcceptance } from "./TermsAcceptance";
|
|
10
|
+
|
|
11
|
+
export function Form() {
|
|
12
|
+
const { kcContext } = useKcContext();
|
|
13
|
+
assert(kcContext.pageId === "register.ftl");
|
|
14
|
+
const { kcClsx } = useKcClsx();
|
|
15
|
+
const { msg, msgStr } = useI18n();
|
|
16
|
+
|
|
17
|
+
const [isFormSubmittable, setIsFormSubmittable] = useState(false);
|
|
18
|
+
const [areTermsAccepted, setAreTermsAccepted] = useState(false);
|
|
19
|
+
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
(window as any)["onSubmitRecaptcha"] = () => {
|
|
22
|
+
// @ts-expect-error
|
|
23
|
+
document.getElementById("kc-register-form").requestSubmit();
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
delete (window as any)["onSubmitRecaptcha"];
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<form
|
|
33
|
+
id="kc-register-form"
|
|
34
|
+
action={kcContext.url.registrationAction}
|
|
35
|
+
className="space-y-3"
|
|
36
|
+
method="post"
|
|
37
|
+
>
|
|
38
|
+
<UserProfileFormFields
|
|
39
|
+
onIsFormSubmittableValueChange={setIsFormSubmittable}
|
|
40
|
+
/>
|
|
41
|
+
{kcContext.termsAcceptanceRequired && (
|
|
42
|
+
<TermsAcceptance
|
|
43
|
+
messagesPerField={kcContext.messagesPerField}
|
|
44
|
+
areTermsAccepted={areTermsAccepted}
|
|
45
|
+
onAreTermsAcceptedValueChange={setAreTermsAccepted}
|
|
46
|
+
/>
|
|
47
|
+
)}
|
|
48
|
+
{kcContext.recaptchaRequired &&
|
|
49
|
+
(kcContext.recaptchaVisible ||
|
|
50
|
+
kcContext.recaptchaAction === undefined) && (
|
|
51
|
+
<div className="form-group">
|
|
52
|
+
<div className={kcClsx("kcInputWrapperClass")}>
|
|
53
|
+
<div
|
|
54
|
+
className="g-recaptcha"
|
|
55
|
+
data-size="compact"
|
|
56
|
+
data-sitekey={kcContext.recaptchaSiteKey}
|
|
57
|
+
data-action={kcContext.recaptchaAction}
|
|
58
|
+
></div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
)}
|
|
62
|
+
<div className={kcClsx("kcFormGroupClass")}>
|
|
63
|
+
{kcContext.recaptchaRequired &&
|
|
64
|
+
!kcContext.recaptchaVisible &&
|
|
65
|
+
kcContext.recaptchaAction !== undefined ? (
|
|
66
|
+
<div id="kc-form-buttons" className={kcClsx("kcFormButtonsClass")}>
|
|
67
|
+
<button
|
|
68
|
+
className={clsx(
|
|
69
|
+
kcClsx(
|
|
70
|
+
"kcButtonClass",
|
|
71
|
+
"kcButtonPrimaryClass",
|
|
72
|
+
"kcButtonBlockClass",
|
|
73
|
+
"kcButtonLargeClass"
|
|
74
|
+
),
|
|
75
|
+
"g-recaptcha"
|
|
76
|
+
)}
|
|
77
|
+
data-sitekey={kcContext.recaptchaSiteKey}
|
|
78
|
+
data-callback="onSubmitRecaptcha"
|
|
79
|
+
data-action={kcContext.recaptchaAction}
|
|
80
|
+
type="submit"
|
|
81
|
+
>
|
|
82
|
+
{msg("doRegister")}
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
) : (
|
|
86
|
+
<Button
|
|
87
|
+
disabled={
|
|
88
|
+
!isFormSubmittable ||
|
|
89
|
+
(kcContext.termsAcceptanceRequired && !areTermsAccepted)
|
|
90
|
+
}
|
|
91
|
+
className="w-full mt-2"
|
|
92
|
+
name="register"
|
|
93
|
+
type="submit"
|
|
94
|
+
>
|
|
95
|
+
{msgStr("doRegister")}
|
|
96
|
+
</Button>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div className=" flex justify-end">
|
|
101
|
+
<Button variant="ghost">
|
|
102
|
+
<a href={kcContext.url.loginUrl}>{msg("backToLogin")}</a>
|
|
103
|
+
</Button>
|
|
104
|
+
</div>
|
|
105
|
+
</form>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { KcContext } from '@keycloakify/login-ui/core/KcContext/KcContext';
|
|
3
|
-
import type { Attribute, PasswordPolicies, UserProfile } from "@keycloakify/login-ui/KcContext";
|
|
4
|
-
import { DeepPartial } from '@keycloakify/login-ui/tools/DeepPartial';
|
|
5
|
-
import { JSX } from 'react/jsx-runtime';
|
|
1
|
+
import type { Attribute } from "@keycloakify/login-ui/KcContext";
|
|
6
2
|
import { createKcPageStory, type Meta, type StoryObj } from "../../mocks/KcPageStory";
|
|
7
3
|
|
|
8
4
|
const { KcPageStory } = createKcPageStory({ pageId: "register.ftl" });
|
|
@@ -18,6 +14,27 @@ type Story = StoryObj<typeof meta>;
|
|
|
18
14
|
|
|
19
15
|
export const Default: Story = {};
|
|
20
16
|
|
|
17
|
+
export const Arabic: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
kcContext: {
|
|
20
|
+
locale: {
|
|
21
|
+
currentLanguageTag: "ar",
|
|
22
|
+
rtl: true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export const French: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
kcContext: {
|
|
30
|
+
locale: {
|
|
31
|
+
currentLanguageTag: "fr",
|
|
32
|
+
rtl: false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
21
38
|
export const WithEmailAlreadyExists: Story = {
|
|
22
39
|
args: {
|
|
23
40
|
kcContext: {
|
|
@@ -42,7 +59,8 @@ export const WithEmailAlreadyExists: Story = {
|
|
|
42
59
|
// existsError() so they are the only ones that need to mock.
|
|
43
60
|
existsError: (fieldName: string, ...otherFieldNames: string[]) =>
|
|
44
61
|
[fieldName, ...otherFieldNames].includes("email"),
|
|
45
|
-
get: (fieldName: string) =>
|
|
62
|
+
get: (fieldName: string) =>
|
|
63
|
+
fieldName === "email" ? "Email already exists." : undefined
|
|
46
64
|
}
|
|
47
65
|
}
|
|
48
66
|
}
|
|
@@ -56,12 +74,15 @@ export const WithRestrictedToMITStudents: Story = {
|
|
|
56
74
|
email: {
|
|
57
75
|
validators: {
|
|
58
76
|
pattern: {
|
|
59
|
-
pattern:
|
|
60
|
-
|
|
77
|
+
pattern:
|
|
78
|
+
"^[^@]+@([^.]+\\.)*((mit\\.edu)|(berkeley\\.edu))$",
|
|
79
|
+
"error-message":
|
|
80
|
+
"${profile.attributes.email.pattern.error}"
|
|
61
81
|
}
|
|
62
82
|
},
|
|
63
83
|
annotations: {
|
|
64
|
-
inputHelperTextBefore:
|
|
84
|
+
inputHelperTextBefore:
|
|
85
|
+
"${profile.attributes.email.inputHelperTextBefore}"
|
|
65
86
|
}
|
|
66
87
|
}
|
|
67
88
|
}
|
|
@@ -92,7 +113,8 @@ export const WithFavoritePet: Story = {
|
|
|
92
113
|
}
|
|
93
114
|
},
|
|
94
115
|
annotations: {
|
|
95
|
-
inputOptionLabelsI18nPrefix:
|
|
116
|
+
inputOptionLabelsI18nPrefix:
|
|
117
|
+
"profile.attributes.favoritePet.options"
|
|
96
118
|
},
|
|
97
119
|
required: false,
|
|
98
120
|
readOnly: false
|
|
@@ -193,14 +215,15 @@ export const WithTermsAcceptance: Story = {
|
|
|
193
215
|
termsAcceptanceRequired: true,
|
|
194
216
|
"x-keycloakify": {
|
|
195
217
|
messages: {
|
|
196
|
-
termsText:
|
|
218
|
+
termsText:
|
|
219
|
+
"<a href='https://example.com/terms'>Service Terms of Use</a>"
|
|
197
220
|
}
|
|
198
221
|
}
|
|
199
222
|
}
|
|
200
223
|
}
|
|
201
224
|
};
|
|
202
225
|
export const WithTermsNotAccepted: Story = {
|
|
203
|
-
render:
|
|
226
|
+
render: args => (
|
|
204
227
|
<KcPageStory
|
|
205
228
|
{...args}
|
|
206
229
|
kcContext={{
|
|
@@ -208,7 +231,9 @@ export const WithTermsNotAccepted: Story = {
|
|
|
208
231
|
messagesPerField: {
|
|
209
232
|
existsError: (fieldName: string) => fieldName === "termsAccepted",
|
|
210
233
|
get: (fieldName: string) =>
|
|
211
|
-
fieldName === "termsAccepted"
|
|
234
|
+
fieldName === "termsAccepted"
|
|
235
|
+
? "You must accept the terms."
|
|
236
|
+
: undefined
|
|
212
237
|
}
|
|
213
238
|
}}
|
|
214
239
|
/>
|
|
@@ -224,7 +249,8 @@ export const WithFieldErrors: Story = {
|
|
|
224
249
|
}
|
|
225
250
|
},
|
|
226
251
|
messagesPerField: {
|
|
227
|
-
existsError: (fieldName: string) =>
|
|
252
|
+
existsError: (fieldName: string) =>
|
|
253
|
+
["username", "email"].includes(fieldName),
|
|
228
254
|
get: (fieldName: string) => {
|
|
229
255
|
if (fieldName === "username") return "Username is required.";
|
|
230
256
|
if (fieldName === "email") return "Invalid email format.";
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { assert } from "tsafe/assert";
|
|
2
|
-
import { useKcContext } from "../../KcContext";
|
|
3
|
-
import { Template } from "../../components/Template";
|
|
4
|
-
import { useI18n } from "../../i18n";
|
|
5
|
-
import { Form } from "./Form";
|
|
6
|
-
|
|
7
|
-
export function Page() {
|
|
8
|
-
const { kcContext } = useKcContext();
|
|
9
|
-
assert(kcContext.pageId === "register.ftl");
|
|
10
|
-
|
|
11
|
-
const { msg, advancedMsg } = useI18n();
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Template
|
|
15
|
-
headerNode={
|
|
16
|
-
kcContext.messageHeader !== undefined
|
|
17
|
-
? advancedMsg(kcContext.messageHeader)
|
|
18
|
-
: msg("registerTitle")
|
|
19
|
-
}
|
|
20
|
-
displayMessage={kcContext.messagesPerField.exists("global")}
|
|
21
|
-
displayRequiredFields
|
|
22
|
-
>
|
|
23
|
-
<Form />
|
|
24
|
-
</Template>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
1
|
+
import { assert } from "tsafe/assert";
|
|
2
|
+
import { useKcContext } from "../../KcContext";
|
|
3
|
+
import { Template } from "../../components/Template";
|
|
4
|
+
import { useI18n } from "../../i18n";
|
|
5
|
+
import { Form } from "./Form";
|
|
6
|
+
|
|
7
|
+
export function Page() {
|
|
8
|
+
const { kcContext } = useKcContext();
|
|
9
|
+
assert(kcContext.pageId === "register.ftl");
|
|
10
|
+
|
|
11
|
+
const { msg, advancedMsg } = useI18n();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Template
|
|
15
|
+
headerNode={
|
|
16
|
+
kcContext.messageHeader !== undefined
|
|
17
|
+
? advancedMsg(kcContext.messageHeader)
|
|
18
|
+
: msg("registerTitle")
|
|
19
|
+
}
|
|
20
|
+
displayMessage={kcContext.messagesPerField.exists("global")}
|
|
21
|
+
displayRequiredFields
|
|
22
|
+
>
|
|
23
|
+
<Form />
|
|
24
|
+
</Template>
|
|
25
|
+
);
|
|
26
|
+
}
|