keycloakify 10.0.0-rc.109 → 10.0.0-rc.111

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 (58) hide show
  1. package/PUBLIC_URL.js +2 -2
  2. package/PUBLIC_URL.js.map +1 -1
  3. package/account/KcContext/kcContextMocks.js +3 -3
  4. package/account/i18n/i18n.js +4 -4
  5. package/account/i18n/i18n.js.map +1 -1
  6. package/account/i18n/useI18n.d.ts +1 -1
  7. package/account/i18n/useI18n.js +2 -2
  8. package/account/i18n/useI18n.js.map +1 -1
  9. package/bin/193.index.js +4 -4
  10. package/bin/31.index.js +31 -31
  11. package/bin/440.index.js +59 -59
  12. package/bin/453.index.js +3 -3
  13. package/bin/526.index.js +5 -5
  14. package/bin/622.index.js +1 -1
  15. package/bin/97.index.js +3 -3
  16. package/bin/shared/buildContext.js.map +1 -1
  17. package/bin/shared/constants.d.ts +17 -17
  18. package/bin/shared/constants.js +14 -14
  19. package/bin/shared/constants.js.map +1 -1
  20. package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -1
  21. package/bin/shared/downloadKeycloakDefaultTheme.js.map +1 -1
  22. package/login/KcContext/kcContextMocks.js +3 -3
  23. package/login/i18n/i18n.js +4 -4
  24. package/login/i18n/i18n.js.map +1 -1
  25. package/login/i18n/useI18n.d.ts +1 -1
  26. package/login/i18n/useI18n.js +2 -11
  27. package/login/i18n/useI18n.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/PUBLIC_URL.ts +2 -2
  30. package/src/account/KcContext/kcContextMocks.ts +3 -3
  31. package/src/account/i18n/i18n.tsx +4 -4
  32. package/src/account/i18n/useI18n.tsx +2 -2
  33. package/src/bin/add-story.ts +6 -6
  34. package/src/bin/eject-page.ts +6 -6
  35. package/src/bin/keycloakify/buildJars/buildJar.ts +23 -22
  36. package/src/bin/keycloakify/generateFtl/generateFtl.ts +15 -19
  37. package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +386 -375
  38. package/src/bin/keycloakify/generateResources/bringInAccountV1.ts +7 -7
  39. package/src/bin/keycloakify/generateResources/generateMessageProperties.ts +2 -2
  40. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +17 -19
  41. package/src/bin/keycloakify/generateResources/generateResourcesForThemeVariant.ts +2 -2
  42. package/src/bin/keycloakify/generateResources/readExtraPageNames.ts +4 -4
  43. package/src/bin/keycloakify/keycloakify.ts +7 -5
  44. package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +3 -4
  45. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +6 -6
  46. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +4 -4
  47. package/src/bin/shared/buildContext.ts +9 -8
  48. package/src/bin/shared/constants.ts +17 -17
  49. package/src/bin/shared/copyKeycloakResourcesToPublic.ts +6 -6
  50. package/src/bin/shared/downloadKeycloakDefaultTheme.ts +2 -2
  51. package/src/bin/shared/downloadKeycloakStaticResources.ts +2 -2
  52. package/src/bin/start-keycloak/keycloakifyBuild.ts +2 -2
  53. package/src/bin/start-keycloak/start-keycloak.ts +5 -5
  54. package/src/login/KcContext/kcContextMocks.ts +4 -4
  55. package/src/login/i18n/i18n.tsx +4 -4
  56. package/src/login/i18n/useI18n.tsx +2 -11
  57. package/src/vite-plugin/vite-plugin.ts +8 -8
  58. package/vite-plugin/index.js +42 -42
@@ -1,22 +1,48 @@
1
- <#assign pageId="PAGE_ID_xIgLsPgGId9D8e">
2
- <#assign themeType="KEYCLOAKIFY_THEME_TYPE_dExKd3xEdr">
3
- <#assign xKeycloakifyMessages = {}>
4
- <#assign debugMessage="">
5
-
6
- const kcContext = ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
1
+ <#assign xKeycloakify={
2
+ "messages": {},
3
+ "pageId": "{{pageId}}",
4
+ "ftlTemplateFileName": "{{ftlTemplateFileName}}",
5
+ "themeType": "{{themeType}}",
6
+ "themeName": "{{themeName}}",
7
+ "keycloakifyVersion": "{{keycloakifyVersion}}",
8
+ "themeVersion": "{{themeVersion}}",
9
+ "resourcesPath": ""
10
+ }>
11
+
12
+ <#if url?? && url?is_hash && url.resourcesPath?? && url.resourcesPath?is_string>
13
+ <#assign xKeycloakify = xKeycloakify + { "resourcesPath": url.resourcesPath }>
14
+ </#if>
15
+ <#if resourceUrl?? && resourceUrl?is_string>
16
+ <#assign xKeycloakify = xKeycloakify + { "resourcesPath": resourceUrl }>
17
+ </#if>
18
+
19
+ const kcContext = ${toJsDeclarationString(.data_model, [])?no_esc};
20
+ kcContext.keycloakifyVersion = "${xKeycloakify.keycloakifyVersion}";
21
+ kcContext.themeVersion = "${xKeycloakify.themeVersion}";
22
+ kcContext.themeType = "${xKeycloakify.themeType}";
23
+ kcContext.themeName = "${xKeycloakify.themeName}";
24
+ kcContext.pageId = "${xKeycloakify.pageId}";
25
+ kcContext.ftlTemplateFileName = "${xKeycloakify.ftlTemplateFileName}";
7
26
 
8
27
  <@addNonAutomaticallyGatherableMessagesToXKeycloakifyMessages />
9
28
 
10
- console.log(`${debugMessage}`);
11
-
12
29
  kcContext["x-keycloakify"] = {};
13
30
 
31
+ kcContext["x-keycloakify"].resourcesPath = "${xKeycloakify.resourcesPath}";
32
+
14
33
  {
15
- var messages = {};
16
- <#list xKeycloakifyMessages as key, resolvedMsg>
17
- messages["${key}"] = decodeHtmlEntities("${resolvedMsg?js_string}");
18
- </#list>
19
- kcContext["x-keycloakify"].messages = messages;
34
+ var messages = {};
35
+ <#list xKeycloakify.messages as key, resolvedMsg>
36
+ messages["${key}"] = decodeHtmlEntities("${resolvedMsg?js_string}");
37
+ </#list>
38
+ kcContext["x-keycloakify"].messages = messages;
39
+ }
40
+
41
+ if(
42
+ kcContext.url instanceof Object &&
43
+ typeof kcContext.url.resourcesPath === "string"
44
+ ){
45
+ kcContext.url.resourcesCommonPath = kcContext.url.resourcesPath + "/{{RESOURCES_COMMON}}";
20
46
  }
21
47
 
22
48
  if( kcContext.messagesPerField ){
@@ -44,23 +70,6 @@ if( kcContext.messagesPerField ){
44
70
  }
45
71
  };
46
72
  }
47
- kcContext.keycloakifyVersion = "KEYCLOAKIFY_VERSION_xEdKd3xEdr";
48
- kcContext.themeVersion = "KEYCLOAKIFY_THEME_VERSION_sIgKd3xEdr3dx";
49
- kcContext.themeType = "${themeType}";
50
- kcContext.themeName = "KEYCLOAKIFY_THEME_NAME_cXxKd3xEer";
51
- kcContext.pageId = "${pageId}";
52
- if( kcContext.url && kcContext.url.resourcesPath ){
53
- kcContext.url.resourcesCommonPath = kcContext.url.resourcesPath + "/" + "RESOURCES_COMMON_cLsLsMrtDkpVv";
54
- }
55
- if( kcContext.resourceUrl && !kcContext.url ){
56
- Object.defineProperty(kcContext, "url", {
57
- value: {
58
- resourcesPath: kcContext.resourceUrl
59
- },
60
- enumerable: false
61
- });
62
- }
63
-
64
73
  attributes_to_attributesByName: {
65
74
  if( !kcContext.profile ){
66
75
  break attributes_to_attributesByName;
@@ -86,451 +95,453 @@ function decodeHtmlEntities(htmlStr){
86
95
  return element.value;
87
96
  }
88
97
 
89
- <#function ftl_object_to_js_code_declaring_an_object object path>
98
+ <#function toJsDeclarationString object path>
99
+ <#local isHash = -1>
100
+ <#attempt>
101
+ <#local isHash = object?is_hash || object?is_hash_ex>
102
+ <#recover>
103
+ <#return "ABORT: Can't evaluate if " + path?join(".") + " is a hash">
104
+ </#attempt>
105
+
106
+ <#if isHash>
107
+ <#if path?size gt 10>
108
+ <#return "ABORT: Too many recursive calls, path: " + path?join(".")>
109
+ </#if>
110
+ <#local keys = -1>
90
111
 
91
- <#local isHash = "">
92
112
  <#attempt>
93
- <#local isHash = object?is_hash || object?is_hash_ex>
113
+ <#local keys = object?keys>
94
114
  <#recover>
95
- <#return "ABORT: Can't evaluate if " + path?join(".") + " is hash">
115
+ <#return "ABORT: We can't list keys on object">
96
116
  </#attempt>
97
117
 
98
- <#if isHash>
118
+ <#local outSeq = []>
99
119
 
100
- <#if path?size gt 10>
101
- <#return "ABORT: Too many recursive calls, path: " + path?join(".")>
120
+ <#list keys as key>
121
+ <#if ["class","declaredConstructors","superclass","declaringClass" ]?seq_contains(key) >
122
+ <#continue>
102
123
  </#if>
103
124
 
104
- <#local keys = "">
105
-
106
- <#attempt>
107
- <#local keys = object?keys>
108
- <#recover>
109
- <#return "ABORT: We can't list keys on this object">
110
- </#attempt>
111
-
112
- <#local out_seq = []>
113
-
114
- <#list keys as key>
115
-
116
- <#if ["class","declaredConstructors","superclass","declaringClass" ]?seq_contains(key) >
117
- <#continue>
118
- </#if>
119
-
120
- <#if
125
+ <#if (
126
+ areSamePath(path, ["url"]) &&
127
+ ["loginUpdatePasswordUrl", "loginUpdateProfileUrl", "loginUsernameReminderUrl", "loginUpdateTotpUrl"]?seq_contains(key)
128
+ ) || (
129
+ key == "updateProfileCtx" &&
130
+ areSamePath(path, [])
131
+ ) || (
132
+ <#-- https://github.com/keycloakify/keycloakify/pull/65#issuecomment-991896344 (reports with saml-post-form.ftl) -->
133
+ <#-- https://github.com/keycloakify/keycloakify/issues/91#issue-1212319466 (reports with error.ftl and Kc18) -->
134
+ <#-- https://github.com/keycloakify/keycloakify/issues/109#issuecomment-1134610163 -->
135
+ <#-- https://github.com/keycloakify/keycloakify/issues/357 -->
136
+ <#-- https://github.com/keycloakify/keycloakify/discussions/406#discussioncomment-7514787 -->
137
+ key == "loginAction" &&
138
+ areSamePath(path, ["url"]) &&
139
+ ["saml-post-form.ftl", "error.ftl", "info.ftl", "login-oauth-grant.ftl", "logout-confirm.ftl", "login-oauth2-device-verify-user-code.ftl"]?seq_contains(xKeycloakify.pageId) &&
140
+ !(auth?has_content && auth.showTryAnotherWayLink())
141
+ ) || (
142
+ <#-- https://github.com/keycloakify/keycloakify/issues/362 -->
143
+ ["secretData", "value"]?seq_contains(key) &&
144
+ areSamePath(path, [ "totp", "otpCredentials", "*" ])
145
+ ) || (
146
+ ["contextData", "idpConfig", "idp", "authenticationSession"]?seq_contains(key) &&
147
+ areSamePath(path, ["brokerContext"]) &&
148
+ ["login-idp-link-confirm.ftl", "login-idp-link-email.ftl" ]?seq_contains(xKeycloakify.pageId)
149
+ ) || (
150
+ key == "identityProviderBrokerCtx" &&
151
+ areSamePath(path, []) &&
152
+ ["login-idp-link-confirm.ftl", "login-idp-link-email.ftl" ]?seq_contains(xKeycloakify.pageId)
153
+ ) || (
154
+ ["masterAdminClient", "delegateForUpdate", "defaultRole"]?seq_contains(key) &&
155
+ areSamePath(path, ["realm"])
156
+ ) || (
157
+ xKeycloakify.pageId == "error.ftl" &&
158
+ areSamePath(path, ["realm"]) &&
159
+ !["name", "displayName", "displayNameHtml", "internationalizationEnabled", "registrationEmailAsUsername" ]?seq_contains(key)
160
+ ) || (
161
+ xKeycloakify.pageId == "applications.ftl" &&
162
+ (
163
+ key == "realm" ||
164
+ key == "container"
165
+ ) &&
166
+ isSubpath(path, ["applications", "applications"])
167
+ ) || (
168
+ key == "delegateForUpdate" &&
169
+ areSamePath(path, ["user"])
170
+ ) || (
171
+ <#-- Security audit forwarded by Garth (Gmail) -->
172
+ key == "saml.signing.private.key" &&
173
+ areSamePath(path, ["client", "attributes"])
174
+ ) || (
175
+ <#-- See: https://github.com/keycloakify/keycloakify/issues/534 -->
176
+ key == "password" &&
177
+ areSamePath(path, ["login"])
178
+ ) || (
179
+ <#-- Remove realmAttributes added by https://github.com/jcputney/keycloak-theme-additional-info-extension for peace of mind. -->
180
+ key == "realmAttributes" &&
181
+ areSamePath(path, [])
182
+ ) || (
183
+ <#-- attributesByName adds a lot of noise to the output and is not needed, we already have profile.attributes -->
184
+ key == "attributesByName" &&
185
+ areSamePath(path, ["profile"])
186
+ ) || (
187
+ <#-- We already have the attributes in profile speedup the rendering by filtering it out from the register object -->
188
+ (key == "attributes" || key == "attributesByName") &&
189
+ areSamePath(path, ["register"])
190
+ ) || (
191
+ areSamePath(path, ["properties"]) &&
121
192
  (
122
- ["loginUpdatePasswordUrl", "loginUpdateProfileUrl", "loginUsernameReminderUrl", "loginUpdateTotpUrl"]?seq_contains(key) &&
123
- are_same_path(path, ["url"])
124
- ) || (
125
- key == "updateProfileCtx" &&
126
- are_same_path(path, [])
127
- ) || (
128
- <#-- https://github.com/keycloakify/keycloakify/pull/65#issuecomment-991896344 (reports with saml-post-form.ftl) -->
129
- <#-- https://github.com/keycloakify/keycloakify/issues/91#issue-1212319466 (reports with error.ftl and Kc18) -->
130
- <#-- https://github.com/keycloakify/keycloakify/issues/109#issuecomment-1134610163 -->
131
- <#-- https://github.com/keycloakify/keycloakify/issues/357 -->
132
- <#-- https://github.com/keycloakify/keycloakify/discussions/406#discussioncomment-7514787 -->
133
- key == "loginAction" &&
134
- are_same_path(path, ["url"]) &&
135
- ["saml-post-form.ftl", "error.ftl", "info.ftl", "login-oauth-grant.ftl", "logout-confirm.ftl", "login-oauth2-device-verify-user-code.ftl"]?seq_contains(pageId) &&
136
- !(auth?has_content && auth.showTryAnotherWayLink())
137
- ) || (
138
- <#-- https://github.com/keycloakify/keycloakify/issues/362 -->
139
- ["secretData", "value"]?seq_contains(key) &&
140
- are_same_path(path, [ "totp", "otpCredentials", "*" ])
141
- ) || (
142
- ["contextData", "idpConfig", "idp", "authenticationSession"]?seq_contains(key) &&
143
- are_same_path(path, ["brokerContext"]) &&
144
- ["login-idp-link-confirm.ftl", "login-idp-link-email.ftl" ]?seq_contains(pageId)
145
- ) || (
146
- key == "identityProviderBrokerCtx" &&
147
- are_same_path(path, []) &&
148
- ["login-idp-link-confirm.ftl", "login-idp-link-email.ftl" ]?seq_contains(pageId)
149
- ) || (
150
- ["masterAdminClient", "delegateForUpdate", "defaultRole"]?seq_contains(key) &&
151
- are_same_path(path, ["realm"])
152
- ) || (
153
- "error.ftl" == pageId &&
154
- are_same_path(path, ["realm"]) &&
155
- !["name", "displayName", "displayNameHtml", "internationalizationEnabled", "registrationEmailAsUsername" ]?seq_contains(key)
156
- ) || (
157
- "applications.ftl" == pageId &&
158
- (
159
- key == "realm" ||
160
- key == "container"
161
- ) &&
162
- is_subpath(path, ["applications", "applications"])
163
- ) || (
164
- key == "delegateForUpdate" &&
165
- are_same_path(path, ["user"])
166
- ) || (
167
- <#-- Security audit forwarded by Garth (Gmail) -->
168
- key == "saml.signing.private.key" &&
169
- are_same_path(path, ["client", "attributes"])
170
- ) || (
171
- <#-- See: https://github.com/keycloakify/keycloakify/issues/534 -->
172
- key == "password" &&
173
- are_same_path(path, ["login"])
174
- ) || (
175
- <#-- Remove realmAttributes added by https://github.com/jcputney/keycloak-theme-additional-info-extension for peace of mind. -->
176
- key == "realmAttributes" &&
177
- are_same_path(path, [])
178
- ) || (
179
- <#-- attributesByName adds a lot of noise to the output and is not needed, we already have profile.attributes -->
180
- key == "attributesByName" &&
181
- are_same_path(path, ["profile"])
182
- ) || (
183
- <#-- We already have the attributes in profile speedup the rendering by filtering it out from the register object -->
184
- (key == "attributes" || key == "attributesByName") &&
185
- are_same_path(path, ["register"])
186
- ) || (
187
- are_same_path(path, ["properties"]) &&
188
- (
189
- key?starts_with("kc") ||
190
- key == "locales" ||
191
- key == "import" ||
192
- key == "parent" ||
193
- key == "meta" ||
194
- key == "stylesCommon" ||
195
- key == "styles" ||
196
- key == "accountResourceProvider"
197
- )
198
- ) || (
199
- key == "execution" &&
200
- are_same_path(path, [])
201
- ) || (
202
- key == "entity" &&
203
- are_same_path(path, ["user"])
193
+ key?starts_with("kc") ||
194
+ key == "locales" ||
195
+ key == "import" ||
196
+ key == "parent" ||
197
+ key == "meta" ||
198
+ key == "stylesCommon" ||
199
+ key == "styles" ||
200
+ key == "accountResourceProvider"
204
201
  )
205
- >
206
- <#-- <#local out_seq += ["/*" + path?join(".") + "." + key + " excluded*/"]> -->
207
- <#continue>
208
- </#if>
209
-
210
- <#-- https://github.com/keycloakify/keycloakify/discussions/406 -->
211
- <#if (
212
- ["register.ftl", "register-user-profile.ftl", "terms.ftl", "info.ftl", "login.ftl", "login-update-password.ftl", "login-oauth2-device-verify-user-code.ftl"]?seq_contains(pageId) &&
213
- key == "attemptedUsername" && are_same_path(path, ["auth"])
214
- )>
215
- <#attempt>
216
- <#-- https://github.com/keycloak/keycloak/blob/3a2bf0c04bcde185e497aaa32d0bb7ab7520cf4a/themes/src/main/resources/theme/base/login/template.ftl#L63 -->
217
- <#if !(auth?has_content && auth.showUsername() && !auth.showResetCredentials())>
218
- <#local out_seq += ["/*" + path?join(".") + "." + key + " excluded*/"]>
219
- <#continue>
220
- </#if>
221
- <#recover>
222
- <#local out_seq += ["/*Accessing attemptedUsername throwed an exception */"]>
223
- </#attempt>
224
- </#if>
202
+ ) || (
203
+ key == "execution" &&
204
+ areSamePath(path, [])
205
+ ) || (
206
+ key == "entity" &&
207
+ areSamePath(path, ["user"])
208
+ ) || (
209
+ key == "attributes" &&
210
+ areSamePath(path, ["realm"])
211
+ )
212
+ >
213
+ <#-- <#local outSeq += ["/*" + path?join(".") + "." + key + " excluded*/"]> -->
214
+ <#continue>
215
+ </#if>
225
216
 
226
- USER_DEFINED_EXCLUSIONS_eKsaY4ZsZ4eMr2
227
-
217
+ <#-- https://github.com/keycloakify/keycloakify/discussions/406 -->
218
+ <#if (
219
+ key == "attemptedUsername" &&
220
+ areSamePath(path, ["auth"]) &&
221
+ [
222
+ "register.ftl", "terms.ftl", "info.ftl", "login.ftl",
223
+ "login-update-password.ftl", "login-oauth2-device-verify-user-code.ftl"
224
+ ]?seq_contains(xKeycloakify.pageId)
225
+ )>
228
226
  <#attempt>
229
- <#if !object[key]??>
227
+ <#-- https://github.com/keycloak/keycloak/blob/3a2bf0c04bcde185e497aaa32d0bb7ab7520cf4a/themes/src/main/resources/theme/base/login/template.ftl#L63 -->
228
+ <#if !(auth?has_content && auth.showUsername() && !auth.showResetCredentials())>
229
+ <#local outSeq += ["/*" + path?join(".") + "." + key + " excluded*/"]>
230
230
  <#continue>
231
231
  </#if>
232
232
  <#recover>
233
- <#local out_seq += ["/*Couldn't test if '" + key + "' is available on this object*/"]>
234
- <#continue>
233
+ <#local outSeq += ["/*Accessing attemptedUsername throwed an exception */"]>
235
234
  </#attempt>
235
+ </#if>
236
236
 
237
- <#local propertyValue = "">
237
+ {{userDefinedExclusions}}
238
238
 
239
- <#attempt>
240
- <#local propertyValue = object[key]>
241
- <#recover>
242
- <#local out_seq += ["/*Couldn't dereference '" + key + "' on this object*/"]>
239
+ <#attempt>
240
+ <#if !object[key]??>
243
241
  <#continue>
244
- </#attempt>
242
+ </#if>
243
+ <#recover>
244
+ <#local outSeq += ["/*Couldn't test if '" + key + "' is available on this object*/"]>
245
+ <#continue>
246
+ </#attempt>
247
+
248
+ <#local propertyValue = -1>
245
249
 
246
- <#local rec_out = ftl_object_to_js_code_declaring_an_object(propertyValue, path + [ key ])>
250
+ <#attempt>
251
+ <#local propertyValue = object[key]>
252
+ <#recover>
253
+ <#local outSeq += ["/*Couldn't dereference '" + key + "' on this object*/"]>
254
+ <#continue>
255
+ </#attempt>
247
256
 
248
- <#if rec_out?starts_with("ABORT:")>
257
+ <#local recOut = toJsDeclarationString(propertyValue, path + [ key ])>
249
258
 
250
- <#local errorMessage = rec_out?remove_beginning("ABORT:")>
259
+ <#if recOut?starts_with("ABORT:")>
251
260
 
252
- <#if errorMessage != " It's a method" >
253
- <#local out_seq += ["/*" + key + ": " + errorMessage + "*/"]>
254
- </#if>
261
+ <#local errorMessage = recOut?remove_beginning("ABORT:")>
255
262
 
256
- <#continue>
263
+ <#if errorMessage != " It's a method" >
264
+ <#local outSeq += ["/*" + key + ": " + errorMessage + "*/"]>
257
265
  </#if>
258
266
 
259
- <#local out_seq += ['"' + key + '": ' + rec_out + ","]>
267
+ <#continue>
268
+ </#if>
260
269
 
261
- </#list>
270
+ <#local outSeq += ['"' + key + '": ' + recOut + ","]>
262
271
 
263
- <#return (["{"] + out_seq?map(str -> ""?right_pad(4 * (path?size + 1)) + str) + [ ""?right_pad(4 * path?size) + "}"])?join("\n")>
272
+ </#list>
264
273
 
265
- </#if>
274
+ <#return (["{"] + outSeq?map(str -> ""?right_pad(4 * (path?size + 1)) + str) + [ ""?right_pad(4 * path?size) + "}"])?join("\n")>
266
275
 
267
- <#local isMethod = "">
268
- <#attempt>
269
- <#local isMethod = object?is_method>
270
- <#recover>
271
- <#return "ABORT: Can't test if it'sa method.">
272
- </#attempt>
276
+ </#if>
273
277
 
274
- <#if isMethod>
278
+ <#local isMethod = -1>
279
+ <#attempt>
280
+ <#local isMethod = object?is_method>
281
+ <#recover>
282
+ <#return "ABORT: Can't test if it'sa method.">
283
+ </#attempt>
275
284
 
276
- <#if are_same_path(path, ["auth", "showUsername"])>
277
- <#attempt>
278
- <#return auth.showUsername()?c>
279
- <#recover>
280
- <#return "ABORT: Couldn't evaluate auth.showUsername()">
281
- </#attempt>
282
- </#if>
285
+ <#if isMethod>
283
286
 
284
- <#if are_same_path(path, ["auth", "showResetCredentials"])>
285
- <#attempt>
286
- <#return auth.showResetCredentials()?c>
287
- <#recover>
288
- <#return "ABORT: Couldn't evaluate auth.showResetCredentials()">
289
- </#attempt>
290
- </#if>
287
+ <#if areSamePath(path, ["auth", "showUsername"])>
288
+ <#attempt>
289
+ <#return auth.showUsername()?c>
290
+ <#recover>
291
+ <#return "ABORT: Couldn't evaluate auth.showUsername()">
292
+ </#attempt>
293
+ </#if>
291
294
 
292
- <#if are_same_path(path, ["auth", "showTryAnotherWayLink"])>
293
- <#attempt>
294
- <#return auth.showTryAnotherWayLink()?c>
295
- <#recover>
296
- <#return "ABORT: Couldn't evaluate auth.showTryAnotherWayLink()">
297
- </#attempt>
298
- </#if>
295
+ <#if areSamePath(path, ["auth", "showResetCredentials"])>
296
+ <#attempt>
297
+ <#return auth.showResetCredentials()?c>
298
+ <#recover>
299
+ <#return "ABORT: Couldn't evaluate auth.showResetCredentials()">
300
+ </#attempt>
301
+ </#if>
302
+
303
+ <#if areSamePath(path, ["auth", "showTryAnotherWayLink"])>
304
+ <#attempt>
305
+ <#return auth.showTryAnotherWayLink()?c>
306
+ <#recover>
307
+ <#return "ABORT: Couldn't evaluate auth.showTryAnotherWayLink()">
308
+ </#attempt>
309
+ </#if>
310
+
311
+ <#if areSamePath(path, ["url", "getLogoutUrl"])>
312
+ <#local returnValue = -1>
313
+ <#attempt>
314
+ <#local returnValue = url.getLogoutUrl()>
315
+ <#recover>
316
+ <#return "ABORT: Couldn't evaluate url.getLogoutUrl()">
317
+ </#attempt>
318
+ <#return 'function(){ return "' + returnValue + '"; }'>
319
+ </#if>
299
320
 
300
- <#if are_same_path(path, ["url", "getLogoutUrl"])>
301
- <#local returnValue = "">
321
+ <#if areSamePath(path, ["totp", "policy", "getAlgorithmKey"])>
322
+ <#local returnValue = "error">
323
+ <#if mode?? && mode = "manual">
302
324
  <#attempt>
303
- <#local returnValue = url.getLogoutUrl()>
325
+ <#local returnValue = totp.policy.getAlgorithmKey()>
304
326
  <#recover>
305
- <#return "ABORT: Couldn't evaluate url.getLogoutUrl()">
327
+ <#return "ABORT: Couldn't evaluate totp.policy.getAlgorithmKey()">
306
328
  </#attempt>
307
- <#return 'function(){ return "' + returnValue + '"; }'>
308
329
  </#if>
330
+ <#return 'function(){ return "' + returnValue + '"; }'>
331
+ </#if>
309
332
 
310
- <#if are_same_path(path, ["totp", "policy", "getAlgorithmKey"])>
311
- <#local returnValue = "error">
312
- <#if mode?? && mode = "manual">
313
- <#attempt>
314
- <#local returnValue = totp.policy.getAlgorithmKey()>
315
- <#recover>
316
- <#return "ABORT: Couldn't evaluate totp.policy.getAlgorithmKey()">
317
- </#attempt>
333
+ <#assign fieldNames = [{{fieldNames}}]>
334
+ <#if profile?? && profile.attributes??>
335
+ <#list profile.attributes as attribute>
336
+ <#if fieldNames?seq_contains(attribute.name)>
337
+ <#continue>
318
338
  </#if>
319
- <#return 'function(){ return "' + returnValue + '"; }'>
320
- </#if>
321
-
322
- <#assign fieldNames = [ FIELD_NAMES_eKsIY4ZsZ4xeM ]>
323
- <#if profile?? && profile.attributes??>
324
- <#list profile.attributes as attribute>
325
- <#if fieldNames?seq_contains(attribute.name)>
326
- <#continue>
327
- </#if>
328
- <#assign fieldNames += [attribute.name]>
329
- </#list>
330
- </#if>
331
-
332
- <#if are_same_path(path, ["messagesPerField", "get"])>
333
-
334
- <#local jsFunctionCode = "function (fieldName) { ">
339
+ <#assign fieldNames += [attribute.name]>
340
+ </#list>
341
+ </#if>
335
342
 
336
- <#list fieldNames as fieldName>
343
+ <#if areSamePath(path, ["messagesPerField", "get"])>
337
344
 
338
- <#-- See: https://github.com/keycloakify/keycloakify/issues/217 -->
339
- <#if pageId == "login.ftl" >
345
+ <#local jsFunctionCode = "function (fieldName) { ">
340
346
 
341
- <#if fieldName == "username">
347
+ <#list fieldNames as fieldName>
342
348
 
343
- <#local jsFunctionCode += "if(fieldName === 'username' || fieldName === 'password' ){ ">
349
+ <#-- See: https://github.com/keycloakify/keycloakify/issues/217 -->
350
+ <#if xKeycloakify.pageId == "login.ftl" >
344
351
 
345
- <#if messagesPerField.exists('username') || messagesPerField.exists('password')>
346
- <#local jsFunctionCode += "return kcContext.message && kcContext.message.summary ? kcContext.message.summary : 'error'; ">
347
- <#else>
348
- <#local jsFunctionCode += "return ''; ">
349
- </#if>
352
+ <#if fieldName == "username">
350
353
 
351
- <#local jsFunctionCode += "} ">
354
+ <#local jsFunctionCode += "if(fieldName === 'username' || fieldName === 'password' ){ ">
352
355
 
353
- <#continue>
356
+ <#if messagesPerField.exists('username') || messagesPerField.exists('password')>
357
+ <#local jsFunctionCode += "return kcContext.message && kcContext.message.summary ? kcContext.message.summary : 'error'; ">
358
+ <#else>
359
+ <#local jsFunctionCode += "return ''; ">
354
360
  </#if>
355
361
 
356
- <#if fieldName == "password">
357
- <#continue>
358
- </#if>
362
+ <#local jsFunctionCode += "} ">
359
363
 
364
+ <#continue>
360
365
  </#if>
361
366
 
362
- <#local jsFunctionCode += "if(fieldName === '" + fieldName + "'){ ">
363
-
364
- <#if messagesPerField.exists('${fieldName}')>
365
- <#local jsFunctionCode += 'return decodeHtmlEntities("' + messagesPerField.get('${fieldName}')?js_string + '"); '>
366
- <#else>
367
- <#local jsFunctionCode += "return ''; ">
367
+ <#if fieldName == "password">
368
+ <#continue>
368
369
  </#if>
369
370
 
370
- <#local jsFunctionCode += "} ">
371
+ </#if>
371
372
 
372
- </#list>
373
+ <#local jsFunctionCode += "if(fieldName === '" + fieldName + "'){ ">
373
374
 
374
- <#local jsFunctionCode += "}">
375
+ <#if messagesPerField.exists('${fieldName}')>
376
+ <#local jsFunctionCode += 'return decodeHtmlEntities("' + messagesPerField.get('${fieldName}')?js_string + '"); '>
377
+ <#else>
378
+ <#local jsFunctionCode += "return ''; ">
379
+ </#if>
375
380
 
376
- <#return jsFunctionCode>
381
+ <#local jsFunctionCode += "} ">
377
382
 
378
- </#if>
383
+ </#list>
379
384
 
380
- <#if are_same_path(path, ["messagesPerField", "existsError"])>
385
+ <#local jsFunctionCode += "}">
381
386
 
382
- <#local jsFunctionCode = "function (fieldName) { ">
387
+ <#return jsFunctionCode>
383
388
 
384
- <#list fieldNames as fieldName>
389
+ </#if>
385
390
 
386
- <#-- See: https://github.com/keycloakify/keycloakify/issues/217 -->
387
- <#if pageId == "login.ftl" >
388
- <#if fieldName == "username">
391
+ <#if areSamePath(path, ["messagesPerField", "existsError"])>
389
392
 
390
- <#local jsFunctionCode += "if(fieldName === 'username' || fieldName === 'password' ){ ">
393
+ <#local jsFunctionCode = "function (fieldName) { ">
391
394
 
392
- <#if messagesPerField.existsError('username') || messagesPerField.existsError('password')>
393
- <#local jsFunctionCode += "return true; ">
394
- <#else>
395
- <#local jsFunctionCode += "return false; ">
396
- </#if>
395
+ <#list fieldNames as fieldName>
397
396
 
398
- <#local jsFunctionCode += "} ">
397
+ <#-- See: https://github.com/keycloakify/keycloakify/issues/217 -->
398
+ <#if xKeycloakify.pageId == "login.ftl" >
399
+ <#if fieldName == "username">
399
400
 
400
- <#continue>
401
- </#if>
401
+ <#local jsFunctionCode += "if(fieldName === 'username' || fieldName === 'password' ){ ">
402
402
 
403
- <#if fieldName == "password">
404
- <#continue>
403
+ <#if messagesPerField.existsError('username') || messagesPerField.existsError('password')>
404
+ <#local jsFunctionCode += "return true; ">
405
+ <#else>
406
+ <#local jsFunctionCode += "return false; ">
405
407
  </#if>
406
- </#if>
407
408
 
408
- <#local jsFunctionCode += "if(fieldName === '" + fieldName + "' ){ ">
409
+ <#local jsFunctionCode += "} ">
409
410
 
410
- <#if messagesPerField.existsError('${fieldName}')>
411
- <#local jsFunctionCode += 'return true; '>
412
- <#else>
413
- <#local jsFunctionCode += "return false; ">
411
+ <#continue>
414
412
  </#if>
415
413
 
416
- <#local jsFunctionCode += "}">
414
+ <#if fieldName == "password">
415
+ <#continue>
416
+ </#if>
417
+ </#if>
418
+
419
+ <#local jsFunctionCode += "if(fieldName === '" + fieldName + "' ){ ">
417
420
 
418
- </#list>
421
+ <#if messagesPerField.existsError('${fieldName}')>
422
+ <#local jsFunctionCode += 'return true; '>
423
+ <#else>
424
+ <#local jsFunctionCode += "return false; ">
425
+ </#if>
419
426
 
420
427
  <#local jsFunctionCode += "}">
421
428
 
422
- <#return jsFunctionCode>
429
+ </#list>
423
430
 
424
- </#if>
431
+ <#local jsFunctionCode += "}">
425
432
 
426
- <#if themeType == "account" && are_same_path(path, ["realm", "isInternationalizationEnabled"])>
427
- <#attempt>
428
- <#return realm.isInternationalizationEnabled()?c>
429
- <#recover>
430
- <#return "ABORT: Couldn't evaluate realm.isInternationalizationEnabled()">
431
- </#attempt>
432
- </#if>
433
+ <#return jsFunctionCode>
433
434
 
434
- <#return "ABORT: It's a method">
435
435
  </#if>
436
436
 
437
- <#local isBoolean = "">
438
- <#attempt>
439
- <#local isBoolean = object?is_boolean>
440
- <#recover>
441
- <#return "ABORT: Can't test if it's a boolean">
442
- </#attempt>
443
-
444
- <#if isBoolean>
445
- <#return object?c>
437
+ <#if xKeycloakify.themeType == "account" && areSamePath(path, ["realm", "isInternationalizationEnabled"])>
438
+ <#attempt>
439
+ <#return realm.isInternationalizationEnabled()?c>
440
+ <#recover>
441
+ <#return "ABORT: Couldn't evaluate realm.isInternationalizationEnabled()">
442
+ </#attempt>
446
443
  </#if>
447
444
 
448
- <#local isEnumerable = "">
449
- <#attempt>
450
- <#local isEnumerable = object?is_enumerable>
451
- <#recover>
452
- <#return "ABORT: Can't test if it's an enumerable">
453
- </#attempt>
445
+ <#return "ABORT: It's a method">
446
+ </#if>
454
447
 
448
+ <#local isBoolean = -1>
449
+ <#attempt>
450
+ <#local isBoolean = object?is_boolean>
451
+ <#recover>
452
+ <#return "ABORT: Can't test if it's a boolean">
453
+ </#attempt>
455
454
 
456
- <#if isEnumerable>
455
+ <#if isBoolean>
456
+ <#return object?c>
457
+ </#if>
457
458
 
458
- <#local out_seq = []>
459
+ <#local isEnumerable = -1>
460
+ <#attempt>
461
+ <#local isEnumerable = object?is_enumerable>
462
+ <#recover>
463
+ <#return "ABORT: Can't test if it's an enumerable">
464
+ </#attempt>
459
465
 
460
- <#local i = 0>
461
466
 
462
- <#list object as array_item>
467
+ <#if isEnumerable>
463
468
 
464
- <#if !array_item??>
465
- <#local out_seq += ["null,"]>
466
- <#continue>
467
- </#if>
469
+ <#local outSeq = []>
468
470
 
469
- <#local rec_out = ftl_object_to_js_code_declaring_an_object(array_item, path + [ i ])>
471
+ <#local i = 0>
470
472
 
471
- <#local i = i + 1>
473
+ <#list object as array_item>
472
474
 
473
- <#if rec_out?starts_with("ABORT:")>
475
+ <#if !array_item??>
476
+ <#local outSeq += ["null,"]>
477
+ <#continue>
478
+ </#if>
474
479
 
475
- <#local errorMessage = rec_out?remove_beginning("ABORT:")>
480
+ <#local recOut = toJsDeclarationString(array_item, path + [ i ])>
476
481
 
477
- <#if errorMessage != " It's a method" >
478
- <#local out_seq += ["/*" + i?string + ": " + errorMessage + "*/"]>
479
- </#if>
482
+ <#local i = i + 1>
480
483
 
481
- <#continue>
484
+ <#if recOut?starts_with("ABORT:")>
485
+
486
+ <#local errorMessage = recOut?remove_beginning("ABORT:")>
487
+
488
+ <#if errorMessage != " It's a method" >
489
+ <#local outSeq += ["/*" + i?string + ": " + errorMessage + "*/"]>
482
490
  </#if>
483
491
 
484
- <#local out_seq += [rec_out + ","]>
492
+ <#continue>
493
+ </#if>
485
494
 
486
- </#list>
495
+ <#local outSeq += [recOut + ","]>
487
496
 
488
- <#return (["["] + out_seq?map(str -> ""?right_pad(4 * (path?size + 1)) + str) + [ ""?right_pad(4 * path?size) + "]"])?join("\n")>
497
+ </#list>
489
498
 
490
- </#if>
499
+ <#return (["["] + outSeq?map(str -> ""?right_pad(4 * (path?size + 1)) + str) + [ ""?right_pad(4 * path?size) + "]"])?join("\n")>
491
500
 
492
- <#local isDate = "">
493
- <#attempt>
494
- <#local isDate = object?is_date_like>
495
- <#recover>
496
- <#return "ABORT: Can't test if it's a date">
497
- </#attempt>
501
+ </#if>
498
502
 
499
- <#if isDate>
500
- <#return '"' + object?datetime?iso_utc + '"'>
501
- </#if>
503
+ <#local isDate = -1>
504
+ <#attempt>
505
+ <#local isDate = object?is_date_like>
506
+ <#recover>
507
+ <#return "ABORT: Can't test if it's a date">
508
+ </#attempt>
502
509
 
503
- <#local isNumber = "">
504
- <#attempt>
505
- <#local isNumber = object?is_number>
506
- <#recover>
507
- <#return "ABORT: Can't test if it's a number">
508
- </#attempt>
510
+ <#if isDate>
511
+ <#return '"' + object?datetime?iso_utc + '"'>
512
+ </#if>
509
513
 
510
- <#if isNumber>
511
- <#return object?c>
512
- </#if>
514
+ <#local isNumber = -1>
515
+ <#attempt>
516
+ <#local isNumber = object?is_number>
517
+ <#recover>
518
+ <#return "ABORT: Can't test if it's a number">
519
+ </#attempt>
513
520
 
514
- <#local isString = "">
515
- <#attempt>
516
- <#local isString = object?is_string>
517
- <#recover>
518
- <#return "ABORT: Can't test if it's a string">
519
- </#attempt>
521
+ <#if isNumber>
522
+ <#return object?c>
523
+ </#if>
520
524
 
521
- <#if isString>
522
- <@addToXKeycloakifyMessagesIfMessageKey str=object />
523
- </#if>
525
+ <#local isString = -1>
526
+ <#attempt>
527
+ <#local isString = object?is_string>
528
+ <#recover>
529
+ <#return "ABORT: Can't test if it's a string">
530
+ </#attempt>
524
531
 
525
- <#attempt>
526
- <#return '"' + object?js_string + '"'>;
527
- <#recover>
528
- </#attempt>
532
+ <#if isString>
533
+ <@addToXKeycloakifyMessagesIfMessageKey str=object />
534
+ </#if>
535
+
536
+ <#attempt>
537
+ <#return '"' + object?js_string + '"'>;
538
+ <#recover>
539
+ </#attempt>
529
540
 
530
- <#return "ABORT: Couldn't convert into string non hash, non method, non boolean, non number, non enumerable object">
541
+ <#return "ABORT: Couldn't convert into string non hash, non method, non boolean, non number, non enumerable object">
531
542
 
532
543
  </#function>
533
- <#function is_subpath path searchedPath>
544
+ <#function isSubpath path searchedPath>
534
545
 
535
546
  <#if path?size < searchedPath?size>
536
547
  <#return false>
@@ -570,8 +581,8 @@ function decodeHtmlEntities(htmlStr){
570
581
 
571
582
  </#function>
572
583
 
573
- <#function are_same_path path searchedPath>
574
- <#return path?size == searchedPath?size && is_subpath(path, searchedPath)>
584
+ <#function areSamePath path searchedPath>
585
+ <#return path?size == searchedPath?size && isSubpath(path, searchedPath)>
575
586
  </#function>
576
587
 
577
588
  <#macro addToXKeycloakifyMessagesIfMessageKey str>
@@ -592,15 +603,17 @@ function decodeHtmlEntities(htmlStr){
592
603
  <#if resolvedMsg==key>
593
604
  <#return>
594
605
  </#if>
595
- <#assign xKeycloakifyMessages = xKeycloakifyMessages + { "${key}": resolvedMsg }>
606
+ <#local messages=xKeycloakify.messages>
607
+ <#local messages = messages + { key: resolvedMsg }>
608
+ <#assign xKeycloakify = xKeycloakify + { "messages": messages }>
596
609
  </#macro>
597
610
 
598
611
  <#function removeBrackets str>
599
- <#if str?starts_with("${") && str?ends_with("}")>
600
- <#return str[2..(str?length-2)]>
601
- <#else>
602
- <#return str>
603
- </#if>
612
+ <#if str?starts_with("${") && str?ends_with("}")>
613
+ <#return str[2..(str?length-2)]>
614
+ <#else>
615
+ <#return str>
616
+ </#if>
604
617
  </#function>
605
618
 
606
619
  <#macro addNonAutomaticallyGatherableMessagesToXKeycloakifyMessages>
@@ -628,7 +641,7 @@ function decodeHtmlEntities(htmlStr){
628
641
  </#list>
629
642
  </#list>
630
643
  </#if>
631
- <#if pageId == "terms.ftl" || termsAcceptanceRequired?? && termsAcceptanceRequired>
644
+ <#if xKeycloakify.pageId == "terms.ftl" || termsAcceptanceRequired?? && termsAcceptanceRequired>
632
645
  <@addToXKeycloakifyMessagesIfMessageKey str="termsText" />
633
646
  </#if>
634
647
  <#if requiredActions?? && requiredActions?is_enumerable>
@@ -640,5 +653,3 @@ function decodeHtmlEntities(htmlStr){
640
653
  </#list>
641
654
  </#if>
642
655
  </#macro>
643
-
644
-