@oussemasahbeni/keycloakify-login-shadcn 250004.0.3 → 250004.0.7

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.
Files changed (169) hide show
  1. package/keycloak-theme/login/KcContext.ts +23 -23
  2. package/keycloak-theme/login/KcPage.tsx +47 -47
  3. package/keycloak-theme/login/assets/img/auth-logo.svg +100 -100
  4. package/keycloak-theme/login/assets/img/shape.svg +71 -71
  5. package/keycloak-theme/login/components/LogoutOtherSessions.tsx +26 -26
  6. package/keycloak-theme/login/components/PasswordWrapper.tsx +35 -35
  7. package/keycloak-theme/login/components/Template/Template.tsx +227 -227
  8. package/keycloak-theme/login/components/Template/index.ts +1 -1
  9. package/keycloak-theme/login/components/Template/useInitializeTemplate.ts +61 -61
  10. package/keycloak-theme/login/components/UserProfileFormFields/AddRemoveButtonsMultiValuedAttribute.tsx +61 -61
  11. package/keycloak-theme/login/components/UserProfileFormFields/DO_MAKE_USER_CONFIRM_PASSWORD.ts +2 -2
  12. package/keycloak-theme/login/components/UserProfileFormFields/FieldErrors.tsx +28 -28
  13. package/keycloak-theme/login/components/UserProfileFormFields/GroupLabel.tsx +70 -70
  14. package/keycloak-theme/login/components/UserProfileFormFields/InputFieldByType.tsx +58 -58
  15. package/keycloak-theme/login/components/UserProfileFormFields/InputTag.tsx +116 -116
  16. package/keycloak-theme/login/components/UserProfileFormFields/InputTagSelects.tsx +135 -135
  17. package/keycloak-theme/login/components/UserProfileFormFields/SelectTag.tsx +114 -114
  18. package/keycloak-theme/login/components/UserProfileFormFields/TextareaTag.tsx +42 -42
  19. package/keycloak-theme/login/components/UserProfileFormFields/UserProfileFormFields.tsx +127 -127
  20. package/keycloak-theme/login/components/UserProfileFormFields/index.ts +1 -1
  21. package/keycloak-theme/login/i18n.ts +47 -47
  22. package/keycloak-theme/login/mocks/getKcContextMock.ts +22 -22
  23. package/keycloak-theme/login/pages/PageIndex.tsx +134 -134
  24. package/keycloak-theme/login/pages/code/Page.stories.tsx +54 -66
  25. package/keycloak-theme/login/pages/code/Page.tsx +89 -89
  26. package/keycloak-theme/login/pages/code/index.ts +3 -3
  27. package/keycloak-theme/login/pages/delete-account-confirm/Page.stories.tsx +39 -46
  28. package/keycloak-theme/login/pages/delete-account-confirm/Page.tsx +63 -63
  29. package/keycloak-theme/login/pages/delete-account-confirm/index.ts +3 -3
  30. package/keycloak-theme/login/pages/delete-credential/Page.stories.tsx +26 -30
  31. package/keycloak-theme/login/pages/delete-credential/Page.tsx +51 -51
  32. package/keycloak-theme/login/pages/delete-credential/index.ts +3 -3
  33. package/keycloak-theme/login/pages/error/Page.stories.tsx +47 -58
  34. package/keycloak-theme/login/pages/error/Page.tsx +42 -42
  35. package/keycloak-theme/login/pages/error/index.ts +3 -3
  36. package/keycloak-theme/login/pages/frontchannel-logout/Page.stories.tsx +25 -32
  37. package/keycloak-theme/login/pages/frontchannel-logout/Page.tsx +84 -84
  38. package/keycloak-theme/login/pages/frontchannel-logout/index.ts +3 -3
  39. package/keycloak-theme/login/pages/idp-review-user-profile/Page.stories.tsx +46 -58
  40. package/keycloak-theme/login/pages/idp-review-user-profile/Page.tsx +52 -52
  41. package/keycloak-theme/login/pages/idp-review-user-profile/index.ts +3 -3
  42. package/keycloak-theme/login/pages/info/Page.stories.tsx +50 -60
  43. package/keycloak-theme/login/pages/info/Page.tsx +92 -92
  44. package/keycloak-theme/login/pages/link-idp-action/Page.stories.tsx +32 -16
  45. package/keycloak-theme/login/pages/link-idp-action/Page.tsx +43 -43
  46. package/keycloak-theme/login/pages/link-idp-action/index.ts +3 -3
  47. package/keycloak-theme/login/pages/login/Form.tsx +242 -242
  48. package/keycloak-theme/login/pages/login/Info.tsx +29 -29
  49. package/keycloak-theme/login/pages/login/Page.stories.tsx +345 -365
  50. package/keycloak-theme/login/pages/login/Page.tsx +44 -44
  51. package/keycloak-theme/login/pages/login/SocialProviders.tsx +107 -107
  52. package/keycloak-theme/login/pages/login/index.ts +3 -3
  53. package/keycloak-theme/login/pages/login/providers/apple.svg +3 -3
  54. package/keycloak-theme/login/pages/login/providers/bitbucket.svg +11 -11
  55. package/keycloak-theme/login/pages/login/providers/discord.svg +4 -4
  56. package/keycloak-theme/login/pages/login/providers/facebook.svg +5 -5
  57. package/keycloak-theme/login/pages/login/providers/github.svg +3 -3
  58. package/keycloak-theme/login/pages/login/providers/gitlab.svg +7 -7
  59. package/keycloak-theme/login/pages/login/providers/google.svg +7 -7
  60. package/keycloak-theme/login/pages/login/providers/instagram.svg +31 -31
  61. package/keycloak-theme/login/pages/login/providers/linkedin.svg +3 -3
  62. package/keycloak-theme/login/pages/login/providers/microsoft.svg +6 -6
  63. package/keycloak-theme/login/pages/login/providers/oidc.svg +5 -5
  64. package/keycloak-theme/login/pages/login/providers/openshift.svg +7 -7
  65. package/keycloak-theme/login/pages/login/providers/paypal.svg +6 -6
  66. package/keycloak-theme/login/pages/login/providers/slack.svg +11 -11
  67. package/keycloak-theme/login/pages/login/providers/stackoverflow.svg +5 -5
  68. package/keycloak-theme/login/pages/login/providers/x.svg +3 -3
  69. package/keycloak-theme/login/pages/login/useProviderLogos.tsx +39 -39
  70. package/keycloak-theme/login/pages/login/useScript.tsx +62 -62
  71. package/keycloak-theme/login/pages/login-config-totp/Page.stories.tsx +45 -59
  72. package/keycloak-theme/login/pages/login-config-totp/Page.tsx +240 -240
  73. package/keycloak-theme/login/pages/login-config-totp/index.ts +3 -3
  74. package/keycloak-theme/login/pages/login-idp-link-confirm/Page.stories.tsx +30 -34
  75. package/keycloak-theme/login/pages/login-idp-link-confirm/Page.tsx +43 -43
  76. package/keycloak-theme/login/pages/login-idp-link-confirm/index.ts +3 -3
  77. package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.stories.tsx +16 -22
  78. package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.tsx +47 -47
  79. package/keycloak-theme/login/pages/login-idp-link-confirm-override/index.ts +3 -3
  80. package/keycloak-theme/login/pages/login-idp-link-email/Page.stories.tsx +54 -62
  81. package/keycloak-theme/login/pages/login-idp-link-email/Page.tsx +54 -54
  82. package/keycloak-theme/login/pages/login-idp-link-email/index.ts +3 -3
  83. package/keycloak-theme/login/pages/login-oauth-grant/Page.stories.tsx +39 -45
  84. package/keycloak-theme/login/pages/login-oauth-grant/Page.tsx +126 -126
  85. package/keycloak-theme/login/pages/login-oauth-grant/index.ts +3 -3
  86. package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/Page.stories.tsx +38 -48
  87. package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/Page.tsx +58 -58
  88. package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/index.ts +3 -3
  89. package/keycloak-theme/login/pages/login-otp/Page.stories.tsx +82 -96
  90. package/keycloak-theme/login/pages/login-otp/Page.tsx +108 -108
  91. package/keycloak-theme/login/pages/login-otp/index.ts +3 -3
  92. package/keycloak-theme/login/pages/login-page-expired/Page.stories.tsx +28 -36
  93. package/keycloak-theme/login/pages/login-page-expired/Page.tsx +47 -47
  94. package/keycloak-theme/login/pages/login-page-expired/index.ts +3 -3
  95. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/Page.stories.tsx +20 -0
  96. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/Page.tsx +233 -233
  97. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/index.ts +3 -3
  98. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/useScript.tsx +63 -63
  99. package/keycloak-theme/login/pages/login-password/Page.stories.tsx +55 -56
  100. package/keycloak-theme/login/pages/login-password/Page.tsx +149 -149
  101. package/keycloak-theme/login/pages/login-password/index.ts +3 -3
  102. package/keycloak-theme/login/pages/login-password/useScript.tsx +63 -63
  103. package/keycloak-theme/login/pages/login-recovery-authn-code-config/Page.stories.tsx +28 -36
  104. package/keycloak-theme/login/pages/login-recovery-authn-code-config/Page.tsx +181 -181
  105. package/keycloak-theme/login/pages/login-recovery-authn-code-config/index.ts +3 -3
  106. package/keycloak-theme/login/pages/login-recovery-authn-code-config/useScript.tsx +145 -145
  107. package/keycloak-theme/login/pages/login-recovery-authn-code-input/Page.stories.tsx +16 -22
  108. package/keycloak-theme/login/pages/login-recovery-authn-code-input/Page.tsx +70 -70
  109. package/keycloak-theme/login/pages/login-recovery-authn-code-input/index.ts +3 -3
  110. package/keycloak-theme/login/pages/login-reset-otp/Page.stories.tsx +62 -74
  111. package/keycloak-theme/login/pages/login-reset-otp/Page.tsx +86 -86
  112. package/keycloak-theme/login/pages/login-reset-otp/index.ts +3 -3
  113. package/keycloak-theme/login/pages/login-reset-password/Form.tsx +68 -68
  114. package/keycloak-theme/login/pages/login-reset-password/Page.stories.tsx +44 -54
  115. package/keycloak-theme/login/pages/login-reset-password/Page.tsx +27 -27
  116. package/keycloak-theme/login/pages/login-reset-password/index.ts +3 -3
  117. package/keycloak-theme/login/pages/login-update-password/Page.stories.tsx +40 -50
  118. package/keycloak-theme/login/pages/login-update-password/Page.tsx +111 -111
  119. package/keycloak-theme/login/pages/login-update-password/index.ts +3 -3
  120. package/keycloak-theme/login/pages/login-update-profile/Page.stories.tsx +28 -36
  121. package/keycloak-theme/login/pages/login-update-profile/Page.tsx +68 -68
  122. package/keycloak-theme/login/pages/login-update-profile/index.ts +3 -3
  123. package/keycloak-theme/login/pages/login-username/Page.stories.tsx +32 -42
  124. package/keycloak-theme/login/pages/login-username/Page.tsx +246 -246
  125. package/keycloak-theme/login/pages/login-username/index.ts +3 -3
  126. package/keycloak-theme/login/pages/login-username/useScript.tsx +62 -62
  127. package/keycloak-theme/login/pages/login-verify-email/Page.stories.tsx +68 -80
  128. package/keycloak-theme/login/pages/login-verify-email/Page.tsx +38 -38
  129. package/keycloak-theme/login/pages/login-verify-email/index.ts +3 -3
  130. package/keycloak-theme/login/pages/login-x509-info/Page.stories.tsx +29 -37
  131. package/keycloak-theme/login/pages/login-x509-info/Page.tsx +75 -75
  132. package/keycloak-theme/login/pages/login-x509-info/index.ts +3 -3
  133. package/keycloak-theme/login/pages/logout-confirm/Page.stories.tsx +34 -42
  134. package/keycloak-theme/login/pages/logout-confirm/Page.tsx +53 -53
  135. package/keycloak-theme/login/pages/logout-confirm/index.ts +3 -3
  136. package/keycloak-theme/login/pages/register/Form.tsx +106 -106
  137. package/keycloak-theme/login/pages/register/Page.stories.tsx +23 -6
  138. package/keycloak-theme/login/pages/register/Page.tsx +26 -26
  139. package/keycloak-theme/login/pages/register/TermsAcceptance.tsx +56 -56
  140. package/keycloak-theme/login/pages/register/index.ts +3 -3
  141. package/keycloak-theme/login/pages/saml-post-form/Page.stories.tsx +16 -22
  142. package/keycloak-theme/login/pages/saml-post-form/Page.tsx +66 -66
  143. package/keycloak-theme/login/pages/saml-post-form/index.ts +3 -3
  144. package/keycloak-theme/login/pages/select-authenticator/Page.stories.tsx +83 -95
  145. package/keycloak-theme/login/pages/select-authenticator/Page.tsx +100 -100
  146. package/keycloak-theme/login/pages/select-authenticator/index.ts +3 -3
  147. package/keycloak-theme/login/pages/select-organization/Page.stories.tsx +62 -49
  148. package/keycloak-theme/login/pages/select-organization/Page.tsx +126 -126
  149. package/keycloak-theme/login/pages/select-organization/index.ts +3 -3
  150. package/keycloak-theme/login/pages/terms/Page.stories.tsx +15 -0
  151. package/keycloak-theme/login/pages/terms/Page.tsx +51 -51
  152. package/keycloak-theme/login/pages/terms/index.ts +3 -3
  153. package/keycloak-theme/login/pages/update-email/Page.stories.tsx +27 -35
  154. package/keycloak-theme/login/pages/update-email/Page.tsx +62 -62
  155. package/keycloak-theme/login/pages/update-email/index.ts +3 -3
  156. package/keycloak-theme/login/pages/webauthn-authenticate/Page.stories.tsx +112 -126
  157. package/keycloak-theme/login/pages/webauthn-authenticate/Page.tsx +202 -202
  158. package/keycloak-theme/login/pages/webauthn-authenticate/index.ts +3 -3
  159. package/keycloak-theme/login/pages/webauthn-authenticate/useScript.tsx +55 -55
  160. package/keycloak-theme/login/pages/webauthn-error/Page.stories.tsx +54 -66
  161. package/keycloak-theme/login/pages/webauthn-error/Page.tsx +73 -73
  162. package/keycloak-theme/login/pages/webauthn-error/index.ts +3 -3
  163. package/keycloak-theme/login/pages/webauthn-register/Page.stories.tsx +39 -49
  164. package/keycloak-theme/login/pages/webauthn-register/Page.tsx +78 -78
  165. package/keycloak-theme/login/pages/webauthn-register/index.ts +3 -3
  166. package/keycloak-theme/login/pages/webauthn-register/useScript.tsx +62 -62
  167. package/keycloak-theme/login/shared/getColorScheme.ts +45 -45
  168. package/keycloak-theme/login/styleLevelCustomization.tsx +35 -35
  169. package/package.json +5 -1
@@ -1,66 +1,66 @@
1
- import { useI18n } from '@/login/i18n';
2
- import { useKcContext } from '@/login/KcContext';
3
- import { useEffect, useState } from "react";
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 === "saml-post-form.ftl");
10
-
11
- const { msgStr, msg } = useI18n();
12
-
13
- const { samlPost } = kcContext;
14
-
15
- const [htmlFormElement, setHtmlFormElement] = useState<HTMLFormElement | null>(null);
16
-
17
- useEffect(() => {
18
- if (htmlFormElement === null) {
19
- return;
20
- }
21
-
22
- // Storybook
23
- if (samlPost.url === "#") {
24
- alert("In a real Keycloak the user would be redirected immediately");
25
- return;
26
- }
27
-
28
- htmlFormElement.requestSubmit();
29
- }, [htmlFormElement]);
30
-
31
- return (
32
- <Template
33
- headerNode={msg("saml.post-form.title")}
34
- >
35
- <p>{msg("saml.post-form.message")}</p>
36
- <form
37
- name="saml-post-binding"
38
- method="post"
39
- action={samlPost.url}
40
- ref={setHtmlFormElement}
41
- >
42
- {samlPost.SAMLRequest && (
43
- <input
44
- type="hidden"
45
- name="SAMLRequest"
46
- value={samlPost.SAMLRequest}
47
- />
48
- )}
49
- {samlPost.SAMLResponse && (
50
- <input
51
- type="hidden"
52
- name="SAMLResponse"
53
- value={samlPost.SAMLResponse}
54
- />
55
- )}
56
- {samlPost.relayState && (
57
- <input type="hidden" name="RelayState" value={samlPost.relayState} />
58
- )}
59
- <noscript>
60
- <p>{msg("saml.post-form.js-disabled")}</p>
61
- <input type="submit" value={msgStr("doContinue")} />
62
- </noscript>
63
- </form>
64
- </Template>
65
- );
66
- }
1
+ import { useI18n } from '@/login/i18n';
2
+ import { useKcContext } from '@/login/KcContext';
3
+ import { useEffect, useState } from "react";
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 === "saml-post-form.ftl");
10
+
11
+ const { msgStr, msg } = useI18n();
12
+
13
+ const { samlPost } = kcContext;
14
+
15
+ const [htmlFormElement, setHtmlFormElement] = useState<HTMLFormElement | null>(null);
16
+
17
+ useEffect(() => {
18
+ if (htmlFormElement === null) {
19
+ return;
20
+ }
21
+
22
+ // Storybook
23
+ if (samlPost.url === "#") {
24
+ alert("In a real Keycloak the user would be redirected immediately");
25
+ return;
26
+ }
27
+
28
+ htmlFormElement.requestSubmit();
29
+ }, [htmlFormElement]);
30
+
31
+ return (
32
+ <Template
33
+ headerNode={msg("saml.post-form.title")}
34
+ >
35
+ <p>{msg("saml.post-form.message")}</p>
36
+ <form
37
+ name="saml-post-binding"
38
+ method="post"
39
+ action={samlPost.url}
40
+ ref={setHtmlFormElement}
41
+ >
42
+ {samlPost.SAMLRequest && (
43
+ <input
44
+ type="hidden"
45
+ name="SAMLRequest"
46
+ value={samlPost.SAMLRequest}
47
+ />
48
+ )}
49
+ {samlPost.SAMLResponse && (
50
+ <input
51
+ type="hidden"
52
+ name="SAMLResponse"
53
+ value={samlPost.SAMLResponse}
54
+ />
55
+ )}
56
+ {samlPost.relayState && (
57
+ <input type="hidden" name="RelayState" value={samlPost.relayState} />
58
+ )}
59
+ <noscript>
60
+ <p>{msg("saml.post-form.js-disabled")}</p>
61
+ <input type="submit" value={msgStr("doContinue")} />
62
+ </noscript>
63
+ </form>
64
+ </Template>
65
+ );
66
+ }
@@ -1,3 +1,3 @@
1
- import { Page } from "./Page";
2
-
3
- export default Page;
1
+ import { Page } from "./Page";
2
+
3
+ export default Page;
@@ -12,101 +12,91 @@ export default meta;
12
12
 
13
13
  type Story = StoryObj<typeof meta>;
14
14
 
15
- export const Default: Story = {
16
- render: () => <KcPageStory />
17
- };
15
+ export const Default: Story = {};
18
16
 
19
17
  export const Arabic: Story = {
20
- render: () => (
21
- <KcPageStory
22
- kcContext={{
23
- locale: {
24
- currentLanguageTag: "ar",
25
- rtl: true
26
- }
27
- }}
28
- />
29
- )
18
+ args: {
19
+ kcContext: {
20
+ locale: {
21
+ currentLanguageTag: "ar",
22
+ rtl: true
23
+ }
24
+ }
25
+ }
30
26
  };
31
27
  export const French: Story = {
32
- render: () => (
33
- <KcPageStory
34
- kcContext={{
35
- locale: {
36
- currentLanguageTag: "fr"
37
- }
38
- }}
39
- />
40
- )
28
+ args: {
29
+ kcContext: {
30
+ locale: {
31
+ currentLanguageTag: "fr"
32
+ }
33
+ }
34
+ }
41
35
  };
42
36
 
43
37
  export const WithDifferentAuthenticationMethods: Story = {
44
- render: () => (
45
- <KcPageStory
46
- kcContext={{
47
- auth: {
48
- authenticationSelections: [
49
- {
50
- authExecId: "25697c4e-0c80-4f2c-8eb7-2c16347e8e8d",
51
- displayName: "auth-username-password-form-display-name",
52
- helpText: "auth-username-password-form-help-text",
53
- iconCssClass: "kcAuthenticatorPasswordClass"
54
- },
55
- {
56
- authExecId: "4cb60872-ce0d-4c8f-a806-e651ed77994b",
57
- displayName: "webauthn-passwordless-display-name",
58
- helpText: "webauthn-passwordless-help-text",
59
- iconCssClass: "kcAuthenticatorWebAuthnPasswordlessClass"
60
- }
61
- ]
62
- }
63
- }}
64
- />
65
- )
38
+ args: {
39
+ kcContext: {
40
+ auth: {
41
+ authenticationSelections: [
42
+ {
43
+ authExecId: "25697c4e-0c80-4f2c-8eb7-2c16347e8e8d",
44
+ displayName: "auth-username-password-form-display-name",
45
+ helpText: "auth-username-password-form-help-text",
46
+ iconCssClass: "kcAuthenticatorPasswordClass"
47
+ },
48
+ {
49
+ authExecId: "4cb60872-ce0d-4c8f-a806-e651ed77994b",
50
+ displayName: "webauthn-passwordless-display-name",
51
+ helpText: "webauthn-passwordless-help-text",
52
+ iconCssClass: "kcAuthenticatorWebAuthnPasswordlessClass"
53
+ }
54
+ ]
55
+ }
56
+ }
57
+ }
66
58
  };
67
59
 
68
60
  export const WithRealmTranslations: Story = {
69
- render: () => (
70
- <KcPageStory
71
- kcContext={{
72
- auth: {
73
- authenticationSelections: [
74
- {
75
- authExecId: "f0c22855-eda7-4092-8565-0c22f77d2ffb",
76
- displayName: "home-idp-discovery-display-name",
77
- helpText: "home-idp-discovery-help-text",
78
- iconCssClass: "kcAuthenticatorDefaultClass"
79
- },
80
- {
81
- authExecId: "20456f5a-8b2b-45f3-98e0-551dcb27e3e1",
82
- displayName: "identity-provider-redirctor-display-name",
83
- helpText: "identity-provider-redirctor-help-text",
84
- iconCssClass: "kcAuthenticatorDefaultClass"
85
- },
86
- {
87
- authExecId: "eb435db9-474e-473a-8da7-c184fa510b96",
88
- displayName: "auth-username-password-form-display-name",
89
- helpText: "auth-username-password-help-text",
90
- iconCssClass: "kcAuthenticatorDefaultClass"
91
- }
92
- ]
93
- },
94
- "x-keycloakify": {
95
- messages: {
96
- "home-idp-discovery-display-name": "Home identity provider",
97
- "home-idp-discovery-help-text":
98
- "Sign in via your home identity provider which will be automatically determined based on your provided email address.",
99
- "identity-provider-redirctor-display-name":
100
- "Identity Provider Redirector",
101
- "identity-provider-redirctor-help-text":
102
- "Sign in via your identity provider.",
103
- "auth-username-password-help-text":
104
- "Sign in via your username and password."
61
+ args: {
62
+ kcContext: {
63
+ auth: {
64
+ authenticationSelections: [
65
+ {
66
+ authExecId: "f0c22855-eda7-4092-8565-0c22f77d2ffb",
67
+ displayName: "home-idp-discovery-display-name",
68
+ helpText: "home-idp-discovery-help-text",
69
+ iconCssClass: "kcAuthenticatorDefaultClass"
70
+ },
71
+ {
72
+ authExecId: "20456f5a-8b2b-45f3-98e0-551dcb27e3e1",
73
+ displayName: "identity-provider-redirctor-display-name",
74
+ helpText: "identity-provider-redirctor-help-text",
75
+ iconCssClass: "kcAuthenticatorDefaultClass"
76
+ },
77
+ {
78
+ authExecId: "eb435db9-474e-473a-8da7-c184fa510b96",
79
+ displayName: "auth-username-password-form-display-name",
80
+ helpText: "auth-username-password-help-text",
81
+ iconCssClass: "kcAuthenticatorDefaultClass"
105
82
  }
83
+ ]
84
+ },
85
+ "x-keycloakify": {
86
+ messages: {
87
+ "home-idp-discovery-display-name": "Home identity provider",
88
+ "home-idp-discovery-help-text":
89
+ "Sign in via your home identity provider which will be automatically determined based on your provided email address.",
90
+ "identity-provider-redirctor-display-name":
91
+ "Identity Provider Redirector",
92
+ "identity-provider-redirctor-help-text":
93
+ "Sign in via your identity provider.",
94
+ "auth-username-password-help-text":
95
+ "Sign in via your username and password."
106
96
  }
107
- }}
108
- />
109
- )
97
+ }
98
+ }
99
+ }
110
100
  };
111
101
 
112
102
  /**
@@ -116,16 +106,14 @@ export const WithRealmTranslations: Story = {
116
106
  * - Key Aspect: Ensures that the component gracefully handles the absence of available authentication methods.
117
107
  */
118
108
  export const WithoutAuthenticationSelections: Story = {
119
- render: () => (
120
- <KcPageStory
121
- kcContext={{
122
- url: {
123
- loginAction: "/mock-login-action"
124
- },
125
- auth: {
126
- authenticationSelections: [] // No authentication methods available
127
- }
128
- }}
129
- />
130
- )
109
+ args: {
110
+ kcContext: {
111
+ url: {
112
+ loginAction: "/mock-login-action"
113
+ },
114
+ auth: {
115
+ authenticationSelections: [] // No authentication methods available
116
+ }
117
+ }
118
+ }
131
119
  };
@@ -1,100 +1,100 @@
1
- import { Button } from "@/components/ui/button";
2
- import { useI18n } from '@/login/i18n';
3
- import { useKcContext } from '@/login/KcContext';
4
- import { ChevronRight, Fingerprint, Globe, KeyRound, Shield } from "lucide-react";
5
- import { FaKey } from "react-icons/fa";
6
- import { assert } from "tsafe/assert";
7
- import { Template } from "../../components/Template";
8
-
9
- const getAuthenticatorIcon = (authSelection: {
10
- displayName: string;
11
- iconCssClass?: string;
12
- }) => {
13
- const displayName = authSelection.displayName.toLowerCase();
14
- const iconClass = authSelection.iconCssClass?.toLowerCase() || "";
15
-
16
- if (
17
- displayName.includes("webauthn") ||
18
- displayName.includes("passwordless") ||
19
- iconClass.includes("webauthn") ||
20
- displayName.includes("passkey")
21
- ) {
22
- return <Fingerprint className="w-5 h-5" />;
23
- }
24
-
25
- if (
26
- displayName.includes("otp") ||
27
- displayName.includes("totp") ||
28
- displayName.includes("authenticator")
29
- ) {
30
- return <Shield className="w-5 h-5" />;
31
- }
32
-
33
- if (
34
- displayName.includes("identity-provider") ||
35
- displayName.includes("idp") ||
36
- displayName.includes("sso") ||
37
- iconClass.includes("identityprovider")
38
- ) {
39
- return <Globe className="w-5 h-5" />;
40
- }
41
-
42
- if (
43
- displayName.includes("password") ||
44
- displayName.includes("username") ||
45
- iconClass.includes("password")
46
- ) {
47
- return <KeyRound className="w-5 h-5" />;
48
- }
49
-
50
- return <FaKey className="w-5 h-5" />;
51
- };
52
-
53
- export function Page() {
54
- const { kcContext } = useKcContext();
55
- assert(kcContext.pageId === "select-authenticator.ftl");
56
-
57
- const { url, auth } = kcContext;
58
-
59
- const { msg, advancedMsg } = useI18n();
60
- return (
61
- <Template
62
- displayInfo={false}
63
- headerNode={msg("loginChooseAuthenticator")}
64
- >
65
- <form
66
- id="kc-select-credential-form"
67
- className="space-y-3"
68
- action={url.loginAction}
69
- method="post"
70
- >
71
- <div className="space-y-2">
72
- {auth.authenticationSelections.map((authenticationSelection, i) => (
73
- <Button
74
- key={i}
75
- variant="outline"
76
- className="w-full h-auto p-4 flex items-center justify-between text-left hover:bg-accent"
77
- type="submit"
78
- name="authenticationExecution"
79
- value={authenticationSelection.authExecId}
80
- >
81
- <div className="flex items-center gap-3 flex-1">
82
- {getAuthenticatorIcon(authenticationSelection)}
83
-
84
- <div className="flex-1 min-w-0">
85
- <div className="font-medium text-sm">
86
- {advancedMsg(authenticationSelection.displayName)}
87
- </div>
88
- <div className="text-xs text-muted-foreground mt-1 whitespace-normal">
89
- {advancedMsg(authenticationSelection.helpText)}
90
- </div>
91
- </div>
92
- </div>
93
- <ChevronRight className="w-4 h-4 text-muted-foreground shrink-0" />
94
- </Button>
95
- ))}
96
- </div>
97
- </form>
98
- </Template>
99
- );
100
- }
1
+ import { Button } from "@/components/ui/button";
2
+ import { useI18n } from '@/login/i18n';
3
+ import { useKcContext } from '@/login/KcContext';
4
+ import { ChevronRight, Fingerprint, Globe, KeyRound, Shield } from "lucide-react";
5
+ import { FaKey } from "react-icons/fa";
6
+ import { assert } from "tsafe/assert";
7
+ import { Template } from "../../components/Template";
8
+
9
+ const getAuthenticatorIcon = (authSelection: {
10
+ displayName: string;
11
+ iconCssClass?: string;
12
+ }) => {
13
+ const displayName = authSelection.displayName.toLowerCase();
14
+ const iconClass = authSelection.iconCssClass?.toLowerCase() || "";
15
+
16
+ if (
17
+ displayName.includes("webauthn") ||
18
+ displayName.includes("passwordless") ||
19
+ iconClass.includes("webauthn") ||
20
+ displayName.includes("passkey")
21
+ ) {
22
+ return <Fingerprint className="w-5 h-5" />;
23
+ }
24
+
25
+ if (
26
+ displayName.includes("otp") ||
27
+ displayName.includes("totp") ||
28
+ displayName.includes("authenticator")
29
+ ) {
30
+ return <Shield className="w-5 h-5" />;
31
+ }
32
+
33
+ if (
34
+ displayName.includes("identity-provider") ||
35
+ displayName.includes("idp") ||
36
+ displayName.includes("sso") ||
37
+ iconClass.includes("identityprovider")
38
+ ) {
39
+ return <Globe className="w-5 h-5" />;
40
+ }
41
+
42
+ if (
43
+ displayName.includes("password") ||
44
+ displayName.includes("username") ||
45
+ iconClass.includes("password")
46
+ ) {
47
+ return <KeyRound className="w-5 h-5" />;
48
+ }
49
+
50
+ return <FaKey className="w-5 h-5" />;
51
+ };
52
+
53
+ export function Page() {
54
+ const { kcContext } = useKcContext();
55
+ assert(kcContext.pageId === "select-authenticator.ftl");
56
+
57
+ const { url, auth } = kcContext;
58
+
59
+ const { msg, advancedMsg } = useI18n();
60
+ return (
61
+ <Template
62
+ displayInfo={false}
63
+ headerNode={msg("loginChooseAuthenticator")}
64
+ >
65
+ <form
66
+ id="kc-select-credential-form"
67
+ className="space-y-3"
68
+ action={url.loginAction}
69
+ method="post"
70
+ >
71
+ <div className="space-y-2">
72
+ {auth.authenticationSelections.map((authenticationSelection, i) => (
73
+ <Button
74
+ key={i}
75
+ variant="outline"
76
+ className="w-full h-auto p-4 flex items-center justify-between text-left hover:bg-accent"
77
+ type="submit"
78
+ name="authenticationExecution"
79
+ value={authenticationSelection.authExecId}
80
+ >
81
+ <div className="flex items-center gap-3 flex-1">
82
+ {getAuthenticatorIcon(authenticationSelection)}
83
+
84
+ <div className="flex-1 min-w-0">
85
+ <div className="font-medium text-sm">
86
+ {advancedMsg(authenticationSelection.displayName)}
87
+ </div>
88
+ <div className="text-xs text-muted-foreground mt-1 whitespace-normal">
89
+ {advancedMsg(authenticationSelection.helpText)}
90
+ </div>
91
+ </div>
92
+ </div>
93
+ <ChevronRight className="w-4 h-4 text-muted-foreground shrink-0" />
94
+ </Button>
95
+ ))}
96
+ </div>
97
+ </form>
98
+ </Template>
99
+ );
100
+ }
@@ -1,3 +1,3 @@
1
- import { Page } from "./Page";
2
-
3
- export default Page;
1
+ import { Page } from "./Page";
2
+
3
+ export default Page;