@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.
Files changed (187) hide show
  1. package/keycloak-theme/components/langauges.tsx +1 -1
  2. package/keycloak-theme/components/theme-toggle.tsx +0 -1
  3. package/keycloak-theme/components/ui/alert.tsx +1 -2
  4. package/keycloak-theme/components/ui/button.tsx +1 -2
  5. package/keycloak-theme/components/ui/card.tsx +0 -1
  6. package/keycloak-theme/components/ui/checkbox.tsx +0 -1
  7. package/keycloak-theme/components/ui/dropdown-menu.tsx +14 -4
  8. package/keycloak-theme/components/ui/field.tsx +0 -1
  9. package/keycloak-theme/components/ui/input-otp.tsx +0 -1
  10. package/keycloak-theme/components/ui/input.tsx +0 -1
  11. package/keycloak-theme/components/ui/label.tsx +1 -2
  12. package/keycloak-theme/components/ui/radio-group.tsx +0 -1
  13. package/keycloak-theme/components/ui/select.tsx +12 -4
  14. package/keycloak-theme/components/ui/separator.tsx +0 -1
  15. package/keycloak-theme/components/ui/tooltip.tsx +0 -1
  16. package/keycloak-theme/login/KcContext.ts +23 -23
  17. package/keycloak-theme/login/KcPage.tsx +45 -47
  18. package/keycloak-theme/login/assets/img/auth-logo.svg +100 -100
  19. package/keycloak-theme/login/assets/img/shape.svg +71 -71
  20. package/keycloak-theme/login/components/LogoutOtherSessions.tsx +24 -26
  21. package/keycloak-theme/login/components/PasswordWrapper.tsx +35 -35
  22. package/keycloak-theme/login/components/Template/Template.tsx +279 -227
  23. package/keycloak-theme/login/components/Template/index.ts +1 -1
  24. package/keycloak-theme/login/components/Template/useInitializeTemplate.ts +61 -61
  25. package/keycloak-theme/login/components/UserProfileFormFields/AddRemoveButtonsMultiValuedAttribute.tsx +65 -61
  26. package/keycloak-theme/login/components/UserProfileFormFields/DO_MAKE_USER_CONFIRM_PASSWORD.ts +2 -2
  27. package/keycloak-theme/login/components/UserProfileFormFields/FieldErrors.tsx +33 -29
  28. package/keycloak-theme/login/components/UserProfileFormFields/GroupLabel.tsx +90 -71
  29. package/keycloak-theme/login/components/UserProfileFormFields/InputFieldByType.tsx +66 -59
  30. package/keycloak-theme/login/components/UserProfileFormFields/InputLabel.tsx +0 -1
  31. package/keycloak-theme/login/components/UserProfileFormFields/InputTag.tsx +133 -116
  32. package/keycloak-theme/login/components/UserProfileFormFields/InputTagSelects.tsx +150 -136
  33. package/keycloak-theme/login/components/UserProfileFormFields/SelectTag.tsx +135 -114
  34. package/keycloak-theme/login/components/UserProfileFormFields/TextareaTag.tsx +55 -43
  35. package/keycloak-theme/login/components/UserProfileFormFields/UserProfileFormFields.tsx +133 -127
  36. package/keycloak-theme/login/components/UserProfileFormFields/index.ts +1 -1
  37. package/keycloak-theme/login/i18n.ts +47 -47
  38. package/keycloak-theme/login/mocks/KcPageStory.tsx +6 -2
  39. package/keycloak-theme/login/mocks/getKcContextMock.ts +22 -22
  40. package/keycloak-theme/login/pages/PageIndex.tsx +130 -134
  41. package/keycloak-theme/login/pages/code/Page.stories.tsx +57 -70
  42. package/keycloak-theme/login/pages/code/Page.tsx +89 -89
  43. package/keycloak-theme/login/pages/code/index.ts +3 -3
  44. package/keycloak-theme/login/pages/delete-account-confirm/Page.stories.tsx +37 -46
  45. package/keycloak-theme/login/pages/delete-account-confirm/Page.tsx +60 -63
  46. package/keycloak-theme/login/pages/delete-account-confirm/index.ts +3 -3
  47. package/keycloak-theme/login/pages/delete-credential/Page.stories.tsx +25 -30
  48. package/keycloak-theme/login/pages/delete-credential/Page.tsx +56 -51
  49. package/keycloak-theme/login/pages/delete-credential/index.ts +3 -3
  50. package/keycloak-theme/login/pages/error/Page.stories.tsx +46 -58
  51. package/keycloak-theme/login/pages/error/Page.tsx +43 -42
  52. package/keycloak-theme/login/pages/error/index.ts +3 -3
  53. package/keycloak-theme/login/pages/frontchannel-logout/Page.stories.tsx +25 -32
  54. package/keycloak-theme/login/pages/frontchannel-logout/Page.tsx +82 -84
  55. package/keycloak-theme/login/pages/frontchannel-logout/index.ts +3 -3
  56. package/keycloak-theme/login/pages/idp-review-user-profile/Page.stories.tsx +46 -59
  57. package/keycloak-theme/login/pages/idp-review-user-profile/Page.tsx +49 -52
  58. package/keycloak-theme/login/pages/idp-review-user-profile/index.ts +3 -3
  59. package/keycloak-theme/login/pages/info/Page.stories.tsx +50 -60
  60. package/keycloak-theme/login/pages/info/Page.tsx +94 -92
  61. package/keycloak-theme/login/pages/link-idp-action/Page.stories.tsx +32 -16
  62. package/keycloak-theme/login/pages/link-idp-action/Page.tsx +45 -43
  63. package/keycloak-theme/login/pages/link-idp-action/index.ts +3 -3
  64. package/keycloak-theme/login/pages/login/Form.tsx +242 -242
  65. package/keycloak-theme/login/pages/login/Info.tsx +29 -29
  66. package/keycloak-theme/login/pages/login/Page.stories.tsx +346 -365
  67. package/keycloak-theme/login/pages/login/Page.tsx +43 -44
  68. package/keycloak-theme/login/pages/login/SocialProviders.tsx +93 -107
  69. package/keycloak-theme/login/pages/login/index.ts +3 -3
  70. package/keycloak-theme/login/pages/login/providers/apple.svg +3 -3
  71. package/keycloak-theme/login/pages/login/providers/bitbucket.svg +11 -11
  72. package/keycloak-theme/login/pages/login/providers/discord.svg +4 -4
  73. package/keycloak-theme/login/pages/login/providers/facebook.svg +5 -5
  74. package/keycloak-theme/login/pages/login/providers/github.svg +3 -3
  75. package/keycloak-theme/login/pages/login/providers/gitlab.svg +7 -7
  76. package/keycloak-theme/login/pages/login/providers/google.svg +7 -7
  77. package/keycloak-theme/login/pages/login/providers/instagram.svg +31 -31
  78. package/keycloak-theme/login/pages/login/providers/linkedin.svg +3 -3
  79. package/keycloak-theme/login/pages/login/providers/microsoft.svg +6 -6
  80. package/keycloak-theme/login/pages/login/providers/oidc.svg +5 -5
  81. package/keycloak-theme/login/pages/login/providers/openshift.svg +7 -7
  82. package/keycloak-theme/login/pages/login/providers/paypal.svg +6 -6
  83. package/keycloak-theme/login/pages/login/providers/slack.svg +11 -11
  84. package/keycloak-theme/login/pages/login/providers/stackoverflow.svg +5 -5
  85. package/keycloak-theme/login/pages/login/providers/x.svg +3 -3
  86. package/keycloak-theme/login/pages/login/useProviderLogos.tsx +39 -39
  87. package/keycloak-theme/login/pages/login/useScript.tsx +62 -62
  88. package/keycloak-theme/login/pages/login-config-totp/Page.stories.tsx +45 -60
  89. package/keycloak-theme/login/pages/login-config-totp/Page.tsx +253 -240
  90. package/keycloak-theme/login/pages/login-config-totp/index.ts +3 -3
  91. package/keycloak-theme/login/pages/login-idp-link-confirm/Page.stories.tsx +30 -35
  92. package/keycloak-theme/login/pages/login-idp-link-confirm/Page.tsx +40 -43
  93. package/keycloak-theme/login/pages/login-idp-link-confirm/index.ts +3 -3
  94. package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.stories.tsx +16 -23
  95. package/keycloak-theme/login/pages/login-idp-link-confirm-override/Page.tsx +44 -47
  96. package/keycloak-theme/login/pages/login-idp-link-confirm-override/index.ts +3 -3
  97. package/keycloak-theme/login/pages/login-idp-link-email/Page.stories.tsx +54 -63
  98. package/keycloak-theme/login/pages/login-idp-link-email/Page.tsx +51 -54
  99. package/keycloak-theme/login/pages/login-idp-link-email/index.ts +3 -3
  100. package/keycloak-theme/login/pages/login-oauth-grant/Page.stories.tsx +39 -45
  101. package/keycloak-theme/login/pages/login-oauth-grant/Page.tsx +136 -126
  102. package/keycloak-theme/login/pages/login-oauth-grant/index.ts +3 -3
  103. package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/Page.stories.tsx +38 -48
  104. package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/Page.tsx +56 -58
  105. package/keycloak-theme/login/pages/login-oauth2-device-verify-user-code/index.ts +3 -3
  106. package/keycloak-theme/login/pages/login-otp/Page.stories.tsx +82 -97
  107. package/keycloak-theme/login/pages/login-otp/Page.tsx +117 -108
  108. package/keycloak-theme/login/pages/login-otp/index.ts +3 -3
  109. package/keycloak-theme/login/pages/login-page-expired/Page.stories.tsx +28 -37
  110. package/keycloak-theme/login/pages/login-page-expired/Page.tsx +45 -47
  111. package/keycloak-theme/login/pages/login-page-expired/index.ts +3 -3
  112. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/Page.stories.tsx +20 -0
  113. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/Page.tsx +290 -233
  114. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/index.ts +3 -3
  115. package/keycloak-theme/login/pages/login-passkeys-conditional-authenticate/useScript.tsx +63 -63
  116. package/keycloak-theme/login/pages/login-password/Page.stories.tsx +55 -56
  117. package/keycloak-theme/login/pages/login-password/Page.tsx +148 -149
  118. package/keycloak-theme/login/pages/login-password/index.ts +3 -3
  119. package/keycloak-theme/login/pages/login-password/useScript.tsx +62 -63
  120. package/keycloak-theme/login/pages/login-recovery-authn-code-config/Page.stories.tsx +28 -36
  121. package/keycloak-theme/login/pages/login-recovery-authn-code-config/Page.tsx +178 -181
  122. package/keycloak-theme/login/pages/login-recovery-authn-code-config/index.ts +3 -3
  123. package/keycloak-theme/login/pages/login-recovery-authn-code-config/useScript.tsx +145 -145
  124. package/keycloak-theme/login/pages/login-recovery-authn-code-input/Page.stories.tsx +16 -22
  125. package/keycloak-theme/login/pages/login-recovery-authn-code-input/Page.tsx +69 -70
  126. package/keycloak-theme/login/pages/login-recovery-authn-code-input/index.ts +3 -3
  127. package/keycloak-theme/login/pages/login-reset-otp/Page.stories.tsx +62 -75
  128. package/keycloak-theme/login/pages/login-reset-otp/Page.tsx +85 -86
  129. package/keycloak-theme/login/pages/login-reset-otp/index.ts +3 -3
  130. package/keycloak-theme/login/pages/login-reset-password/Form.tsx +67 -68
  131. package/keycloak-theme/login/pages/login-reset-password/Page.stories.tsx +44 -55
  132. package/keycloak-theme/login/pages/login-reset-password/Page.tsx +27 -27
  133. package/keycloak-theme/login/pages/login-reset-password/index.ts +3 -3
  134. package/keycloak-theme/login/pages/login-update-password/Page.stories.tsx +40 -51
  135. package/keycloak-theme/login/pages/login-update-password/Page.tsx +109 -111
  136. package/keycloak-theme/login/pages/login-update-password/index.ts +3 -3
  137. package/keycloak-theme/login/pages/login-update-profile/Page.stories.tsx +28 -37
  138. package/keycloak-theme/login/pages/login-update-profile/Page.tsx +67 -68
  139. package/keycloak-theme/login/pages/login-update-profile/index.ts +3 -3
  140. package/keycloak-theme/login/pages/login-username/Page.stories.tsx +32 -43
  141. package/keycloak-theme/login/pages/login-username/Page.tsx +246 -246
  142. package/keycloak-theme/login/pages/login-username/index.ts +3 -3
  143. package/keycloak-theme/login/pages/login-username/useScript.tsx +62 -62
  144. package/keycloak-theme/login/pages/login-verify-email/Page.stories.tsx +68 -81
  145. package/keycloak-theme/login/pages/login-verify-email/Page.tsx +37 -38
  146. package/keycloak-theme/login/pages/login-verify-email/index.ts +3 -3
  147. package/keycloak-theme/login/pages/login-x509-info/Page.stories.tsx +29 -38
  148. package/keycloak-theme/login/pages/login-x509-info/Page.tsx +72 -75
  149. package/keycloak-theme/login/pages/login-x509-info/index.ts +3 -3
  150. package/keycloak-theme/login/pages/logout-confirm/Page.stories.tsx +34 -43
  151. package/keycloak-theme/login/pages/logout-confirm/Page.tsx +50 -53
  152. package/keycloak-theme/login/pages/logout-confirm/index.ts +3 -3
  153. package/keycloak-theme/login/pages/register/Form.tsx +107 -106
  154. package/keycloak-theme/login/pages/register/Page.stories.tsx +40 -14
  155. package/keycloak-theme/login/pages/register/Page.tsx +26 -26
  156. package/keycloak-theme/login/pages/register/TermsAcceptance.tsx +55 -56
  157. package/keycloak-theme/login/pages/register/index.ts +3 -3
  158. package/keycloak-theme/login/pages/saml-post-form/Page.stories.tsx +16 -23
  159. package/keycloak-theme/login/pages/saml-post-form/Page.tsx +64 -66
  160. package/keycloak-theme/login/pages/saml-post-form/index.ts +3 -3
  161. package/keycloak-theme/login/pages/select-authenticator/Page.stories.tsx +83 -96
  162. package/keycloak-theme/login/pages/select-authenticator/Page.tsx +97 -100
  163. package/keycloak-theme/login/pages/select-authenticator/index.ts +3 -3
  164. package/keycloak-theme/login/pages/select-organization/Page.stories.tsx +62 -49
  165. package/keycloak-theme/login/pages/select-organization/Page.tsx +123 -126
  166. package/keycloak-theme/login/pages/select-organization/index.ts +3 -3
  167. package/keycloak-theme/login/pages/terms/Page.stories.tsx +15 -0
  168. package/keycloak-theme/login/pages/terms/Page.tsx +49 -51
  169. package/keycloak-theme/login/pages/terms/index.ts +3 -3
  170. package/keycloak-theme/login/pages/update-email/Page.stories.tsx +27 -36
  171. package/keycloak-theme/login/pages/update-email/Page.tsx +61 -62
  172. package/keycloak-theme/login/pages/update-email/index.ts +3 -3
  173. package/keycloak-theme/login/pages/webauthn-authenticate/Page.stories.tsx +112 -127
  174. package/keycloak-theme/login/pages/webauthn-authenticate/Page.tsx +206 -202
  175. package/keycloak-theme/login/pages/webauthn-authenticate/index.ts +3 -3
  176. package/keycloak-theme/login/pages/webauthn-authenticate/useScript.tsx +55 -55
  177. package/keycloak-theme/login/pages/webauthn-error/Page.stories.tsx +52 -67
  178. package/keycloak-theme/login/pages/webauthn-error/Page.tsx +70 -73
  179. package/keycloak-theme/login/pages/webauthn-error/index.ts +3 -3
  180. package/keycloak-theme/login/pages/webauthn-register/Page.stories.tsx +39 -50
  181. package/keycloak-theme/login/pages/webauthn-register/Page.tsx +78 -78
  182. package/keycloak-theme/login/pages/webauthn-register/index.ts +3 -3
  183. package/keycloak-theme/login/pages/webauthn-register/useScript.tsx +62 -62
  184. package/keycloak-theme/login/shared/getColorScheme.ts +45 -45
  185. package/keycloak-theme/login/styleLevelCustomization.tsx +34 -36
  186. package/keycloak-theme/public/site.webmanifest +11 -1
  187. 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: "webauthn-error.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
- render: () => (
21
- <KcPageStory
22
- kcContext={{
23
- locale: {
24
- currentLanguageTag: "ar",
25
- rtl: true
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
- render: () => (
33
- <KcPageStory
34
- kcContext={{
35
- locale: {
36
- currentLanguageTag: "fr"
37
- }
38
- }}
39
- />
40
- )
27
+ args: {
28
+ kcContext: {
29
+ locale: {
30
+ currentLanguageTag: "fr"
31
+ }
32
+ }
33
+ }
41
34
  };
42
35
 
43
36
  /**
@@ -47,20 +40,18 @@ export const French: Story = {
47
40
  * - Key Aspect: Ensures the retry button functionality is visible and the user can retry authentication.
48
41
  */
49
42
  export const WithRetryAvailable: Story = {
50
- render: () => (
51
- <KcPageStory
52
- kcContext={{
53
- url: {
54
- loginAction: "/mock-login-action"
55
- },
56
- isAppInitiatedAction: false,
57
- message: {
58
- summary: "WebAuthn authentication failed. Please try again.",
59
- type: "error"
60
- }
61
- }}
62
- />
63
- )
43
+ args: {
44
+ kcContext: {
45
+ url: {
46
+ loginAction: "/mock-login-action"
47
+ },
48
+ isAppInitiatedAction: false,
49
+ message: {
50
+ summary: "WebAuthn authentication failed. Please try again.",
51
+ type: "error"
52
+ }
53
+ }
54
+ }
64
55
  };
65
56
 
66
57
  /**
@@ -70,21 +61,18 @@ export const WithRetryAvailable: Story = {
70
61
  * - Key Aspect: Ensures the form renders correctly with both "Try Again" and "Cancel" options.
71
62
  */
72
63
  export const WithAppInitiatedAction: Story = {
73
- render: () => (
74
- <KcPageStory
75
- kcContext={{
76
- url: {
77
- loginAction: "/mock-login-action"
78
- },
79
- isAppInitiatedAction: true,
80
- message: {
81
- summary:
82
- "WebAuthn authentication failed. You can try again or cancel.",
83
- type: "error"
84
- }
85
- }}
86
- />
87
- )
64
+ args: {
65
+ kcContext: {
66
+ url: {
67
+ loginAction: "/mock-login-action"
68
+ },
69
+ isAppInitiatedAction: true,
70
+ message: {
71
+ summary: "WebAuthn authentication failed. You can try again or cancel.",
72
+ type: "error"
73
+ }
74
+ }
75
+ }
88
76
  };
89
77
 
90
78
  /**
@@ -94,19 +82,16 @@ export const WithAppInitiatedAction: Story = {
94
82
  * - Key Aspect: Ensures the retry mechanism works properly when JavaScript is disabled or unavailable.
95
83
  */
96
84
  export const WithJavaScriptDisabled: Story = {
97
- render: () => (
98
- <KcPageStory
99
- kcContext={{
100
- url: {
101
- loginAction: "/mock-login-action"
102
- },
103
- isAppInitiatedAction: false,
104
- message: {
105
- summary:
106
- "JavaScript is disabled or not working. Please retry manually.",
107
- type: "warning"
108
- }
109
- }}
110
- />
111
- )
85
+ args: {
86
+ kcContext: {
87
+ url: {
88
+ loginAction: "/mock-login-action"
89
+ },
90
+ isAppInitiatedAction: false,
91
+ message: {
92
+ summary: "JavaScript is disabled or not working. Please retry manually.",
93
+ type: "warning"
94
+ }
95
+ }
96
+ }
112
97
  };
@@ -1,73 +1,70 @@
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 === "webauthn-error.ftl");
10
-
11
- const { url, isAppInitiatedAction } = kcContext;
12
-
13
- const { msg, msgStr } = useI18n();
14
-
15
- return (
16
- <Template
17
- displayMessage
18
- headerNode={msg("webauthn-error-title")}
19
- >
20
- <div className="space-y-4">
21
- <form
22
- id="kc-error-credential-form"
23
- action={url.loginAction}
24
- method="post"
25
- >
26
- <input
27
- type="hidden"
28
- id="executionValue"
29
- name="authenticationExecution"
30
- />
31
- <input type="hidden" id="isSetRetry" name="isSetRetry" />
32
- </form>
33
-
34
- <Button
35
- tabIndex={4}
36
- onClick={() => {
37
- // @ts-expect-error: Trusted Keycloak's code
38
- document.getElementById("isSetRetry").value = "retry";
39
- // @ts-expect-error: Trusted Keycloak's code
40
- document.getElementById("executionValue").value = "${execution}";
41
- // @ts-expect-error: Trusted Keycloak's code
42
- document.getElementById("kc-error-credential-form").submit();
43
- }}
44
- type="button"
45
- className="w-full"
46
- name="try-again"
47
- id="kc-try-again"
48
- >
49
- {msgStr("doTryAgain")}
50
- </Button>
51
-
52
- {isAppInitiatedAction && (
53
- <form
54
- action={url.loginAction}
55
- id="kc-webauthn-settings-form"
56
- method="post"
57
- >
58
- <Button
59
- type="submit"
60
- variant="outline"
61
- className="w-full"
62
- id="cancelWebAuthnAIA"
63
- name="cancel-aia"
64
- value="true"
65
- >
66
- {msgStr("doCancel")}
67
- </Button>
68
- </form>
69
- )}
70
- </div>
71
- </Template>
72
- );
73
- }
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 === "webauthn-error.ftl");
10
+
11
+ const { url, isAppInitiatedAction } = kcContext;
12
+
13
+ const { msg, msgStr } = useI18n();
14
+
15
+ return (
16
+ <Template displayMessage headerNode={msg("webauthn-error-title")}>
17
+ <div className="space-y-4">
18
+ <form
19
+ id="kc-error-credential-form"
20
+ action={url.loginAction}
21
+ method="post"
22
+ >
23
+ <input
24
+ type="hidden"
25
+ id="executionValue"
26
+ name="authenticationExecution"
27
+ />
28
+ <input type="hidden" id="isSetRetry" name="isSetRetry" />
29
+ </form>
30
+
31
+ <Button
32
+ tabIndex={4}
33
+ onClick={() => {
34
+ // @ts-expect-error: Trusted Keycloak's code
35
+ document.getElementById("isSetRetry").value = "retry";
36
+ // @ts-expect-error: Trusted Keycloak's code
37
+ document.getElementById("executionValue").value = "${execution}";
38
+ // @ts-expect-error: Trusted Keycloak's code
39
+ document.getElementById("kc-error-credential-form").submit();
40
+ }}
41
+ type="button"
42
+ className="w-full"
43
+ name="try-again"
44
+ id="kc-try-again"
45
+ >
46
+ {msgStr("doTryAgain")}
47
+ </Button>
48
+
49
+ {isAppInitiatedAction && (
50
+ <form
51
+ action={url.loginAction}
52
+ id="kc-webauthn-settings-form"
53
+ method="post"
54
+ >
55
+ <Button
56
+ type="submit"
57
+ variant="outline"
58
+ className="w-full"
59
+ id="cancelWebAuthnAIA"
60
+ name="cancel-aia"
61
+ value="true"
62
+ >
63
+ {msgStr("doCancel")}
64
+ </Button>
65
+ </form>
66
+ )}
67
+ </div>
68
+ </Template>
69
+ );
70
+ }
@@ -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,6 +1,5 @@
1
1
  import { createKcPageStory, type Meta, type StoryObj } from "../../mocks/KcPageStory";
2
2
 
3
-
4
3
  const { KcPageStory } = createKcPageStory({ pageId: "webauthn-register.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
- render: () => (
21
- <KcPageStory
22
- kcContext={{
23
- locale: {
24
- currentLanguageTag: "ar",
25
- rtl: true
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
- render: () => (
33
- <KcPageStory
34
- kcContext={{
35
- locale: {
36
- currentLanguageTag: "fr"
37
- }
38
- }}
39
- />
40
- )
27
+ args: {
28
+ kcContext: {
29
+ locale: {
30
+ currentLanguageTag: "fr"
31
+ }
32
+ }
33
+ }
41
34
  };
42
35
 
43
36
  /**
@@ -47,17 +40,15 @@ export const French: Story = {
47
40
  * - Key Aspect: Ensures the retry functionality is available and the form allows the user to retry.
48
41
  */
49
42
  export const WithRetryAvailable: Story = {
50
- render: () => (
51
- <KcPageStory
52
- kcContext={{
53
- url: {
54
- loginAction: "/mock-login-action"
55
- },
56
- isSetRetry: true,
57
- isAppInitiatedAction: false
58
- }}
59
- />
60
- )
43
+ args: {
44
+ kcContext: {
45
+ url: {
46
+ loginAction: "/mock-login-action"
47
+ },
48
+ isSetRetry: true,
49
+ isAppInitiatedAction: false
50
+ }
51
+ }
61
52
  };
62
53
 
63
54
  /**
@@ -67,20 +58,18 @@ export const WithRetryAvailable: Story = {
67
58
  * - Key Aspect: Ensures the error message is displayed correctly, informing the user of the registration failure.
68
59
  */
69
60
  export const WithErrorDuringRegistration: Story = {
70
- render: () => (
71
- <KcPageStory
72
- kcContext={{
73
- url: {
74
- loginAction: "/mock-login-action"
75
- },
76
- isSetRetry: false,
77
- isAppInitiatedAction: false,
78
- message: {
79
- summary:
80
- "An error occurred during WebAuthn registration. Please try again.",
81
- type: "error"
82
- }
83
- }}
84
- />
85
- )
61
+ args: {
62
+ kcContext: {
63
+ url: {
64
+ loginAction: "/mock-login-action"
65
+ },
66
+ isSetRetry: false,
67
+ isAppInitiatedAction: false,
68
+ message: {
69
+ summary:
70
+ "An error occurred during WebAuthn registration. Please try again.",
71
+ type: "error"
72
+ }
73
+ }
74
+ }
86
75
  };
@@ -1,78 +1,78 @@
1
- import { Button } from "@/components/ui/button";
2
- import { LogoutOtherSessions } from '@/login/components/LogoutOtherSessions';
3
- import { useI18n } from '@/login/i18n';
4
- import { useKcContext } from '@/login/KcContext';
5
- import { assert } from "tsafe/assert";
6
- import { Template } from "../../components/Template";
7
- import { useScript } from './useScript';
8
-
9
- export function Page() {
10
- const { kcContext } = useKcContext();
11
- assert(kcContext.pageId === "webauthn-register.ftl");
12
-
13
- const { msg, msgStr } = useI18n();
14
-
15
- const webAuthnButtonId = "authenticateWebAuthnButton";
16
-
17
- useScript({ webAuthnButtonId });
18
-
19
- return (
20
- <Template
21
- headerNode={
22
- <div className="flex items-center justify-center gap-2">
23
- <span>{msg("webauthn-registration-title")}</span>
24
- </div>
25
- }
26
- >
27
- <div className="space-y-6">
28
- <form id="register" action={kcContext.url.loginAction} method="post">
29
- <input type="hidden" id="clientDataJSON" name="clientDataJSON" />
30
- <input
31
- type="hidden"
32
- id="attestationObject"
33
- name="attestationObject"
34
- />
35
- <input
36
- type="hidden"
37
- id="publicKeyCredentialId"
38
- name="publicKeyCredentialId"
39
- />
40
- <input
41
- type="hidden"
42
- id="authenticatorLabel"
43
- name="authenticatorLabel"
44
- />
45
- <input type="hidden" id="transports" name="transports" />
46
- <input type="hidden" id="error" name="error" />
47
- </form>
48
-
49
- <LogoutOtherSessions />
50
-
51
- <div className="space-y-3">
52
- <Button type="button" className="w-full" id={webAuthnButtonId}>
53
- {msgStr("doRegisterSecurityKey")}
54
- </Button>
55
-
56
- {!kcContext.isSetRetry && kcContext.isAppInitiatedAction && (
57
- <form
58
- action={kcContext.url.loginAction}
59
- id="kc-webauthn-settings-form"
60
- method="post"
61
- >
62
- <Button
63
- type="submit"
64
- variant="outline"
65
- className="w-full"
66
- id="cancelWebAuthnAIA"
67
- name="cancel-aia"
68
- value="true"
69
- >
70
- {msgStr("doCancel")}
71
- </Button>
72
- </form>
73
- )}
74
- </div>
75
- </div>
76
- </Template>
77
- );
78
- }
1
+ import { Button } from "@/components/ui/button";
2
+ import { LogoutOtherSessions } from "@/login/components/LogoutOtherSessions";
3
+ import { useI18n } from "@/login/i18n";
4
+ import { useKcContext } from "@/login/KcContext";
5
+ import { assert } from "tsafe/assert";
6
+ import { Template } from "../../components/Template";
7
+ import { useScript } from "./useScript";
8
+
9
+ export function Page() {
10
+ const { kcContext } = useKcContext();
11
+ assert(kcContext.pageId === "webauthn-register.ftl");
12
+
13
+ const { msg, msgStr } = useI18n();
14
+
15
+ const webAuthnButtonId = "authenticateWebAuthnButton";
16
+
17
+ useScript({ webAuthnButtonId });
18
+
19
+ return (
20
+ <Template
21
+ headerNode={
22
+ <div className="flex items-center justify-center gap-2">
23
+ <span>{msg("webauthn-registration-title")}</span>
24
+ </div>
25
+ }
26
+ >
27
+ <div className="space-y-6">
28
+ <form id="register" action={kcContext.url.loginAction} method="post">
29
+ <input type="hidden" id="clientDataJSON" name="clientDataJSON" />
30
+ <input
31
+ type="hidden"
32
+ id="attestationObject"
33
+ name="attestationObject"
34
+ />
35
+ <input
36
+ type="hidden"
37
+ id="publicKeyCredentialId"
38
+ name="publicKeyCredentialId"
39
+ />
40
+ <input
41
+ type="hidden"
42
+ id="authenticatorLabel"
43
+ name="authenticatorLabel"
44
+ />
45
+ <input type="hidden" id="transports" name="transports" />
46
+ <input type="hidden" id="error" name="error" />
47
+ </form>
48
+
49
+ <LogoutOtherSessions />
50
+
51
+ <div className="space-y-3">
52
+ <Button type="button" className="w-full" id={webAuthnButtonId}>
53
+ {msgStr("doRegisterSecurityKey")}
54
+ </Button>
55
+
56
+ {!kcContext.isSetRetry && kcContext.isAppInitiatedAction && (
57
+ <form
58
+ action={kcContext.url.loginAction}
59
+ id="kc-webauthn-settings-form"
60
+ method="post"
61
+ >
62
+ <Button
63
+ type="submit"
64
+ variant="outline"
65
+ className="w-full"
66
+ id="cancelWebAuthnAIA"
67
+ name="cancel-aia"
68
+ value="true"
69
+ >
70
+ {msgStr("doCancel")}
71
+ </Button>
72
+ </form>
73
+ )}
74
+ </div>
75
+ </div>
76
+ </Template>
77
+ );
78
+ }
@@ -1,3 +1,3 @@
1
- import { Page } from "./Page";
2
-
3
- export default Page;
1
+ import { Page } from "./Page";
2
+
3
+ export default Page;