keycloakify 10.0.0-rc.110 → 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.
- package/PUBLIC_URL.js +2 -2
- package/PUBLIC_URL.js.map +1 -1
- package/account/KcContext/kcContextMocks.js +3 -3
- package/account/i18n/i18n.js +4 -4
- package/account/i18n/i18n.js.map +1 -1
- package/account/i18n/useI18n.d.ts +1 -1
- package/account/i18n/useI18n.js +2 -2
- package/account/i18n/useI18n.js.map +1 -1
- package/bin/193.index.js +4 -4
- package/bin/31.index.js +31 -31
- package/bin/440.index.js +52 -51
- package/bin/453.index.js +3 -3
- package/bin/526.index.js +5 -5
- package/bin/622.index.js +1 -1
- package/bin/97.index.js +3 -3
- package/bin/shared/buildContext.js.map +1 -1
- package/bin/shared/constants.d.ts +17 -17
- package/bin/shared/constants.js +14 -14
- package/bin/shared/constants.js.map +1 -1
- package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -1
- package/bin/shared/downloadKeycloakDefaultTheme.js.map +1 -1
- package/login/KcContext/kcContextMocks.js +3 -3
- package/login/i18n/i18n.js +4 -4
- package/login/i18n/i18n.js.map +1 -1
- package/login/i18n/useI18n.d.ts +1 -1
- package/login/i18n/useI18n.js +2 -11
- package/login/i18n/useI18n.js.map +1 -1
- package/package.json +1 -1
- package/src/PUBLIC_URL.ts +2 -2
- package/src/account/KcContext/kcContextMocks.ts +3 -3
- package/src/account/i18n/i18n.tsx +4 -4
- package/src/account/i18n/useI18n.tsx +2 -2
- package/src/bin/add-story.ts +6 -6
- package/src/bin/eject-page.ts +6 -6
- package/src/bin/keycloakify/buildJars/buildJar.ts +13 -8
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +15 -19
- package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +386 -375
- package/src/bin/keycloakify/generateResources/bringInAccountV1.ts +7 -7
- package/src/bin/keycloakify/generateResources/generateMessageProperties.ts +2 -2
- package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +17 -19
- package/src/bin/keycloakify/generateResources/generateResourcesForThemeVariant.ts +2 -2
- package/src/bin/keycloakify/generateResources/readExtraPageNames.ts +4 -4
- package/src/bin/keycloakify/keycloakify.ts +7 -5
- package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +3 -4
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +6 -6
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +4 -4
- package/src/bin/shared/buildContext.ts +9 -8
- package/src/bin/shared/constants.ts +17 -17
- package/src/bin/shared/copyKeycloakResourcesToPublic.ts +6 -6
- package/src/bin/shared/downloadKeycloakDefaultTheme.ts +2 -2
- package/src/bin/shared/downloadKeycloakStaticResources.ts +2 -2
- package/src/bin/start-keycloak/keycloakifyBuild.ts +2 -2
- package/src/bin/start-keycloak/start-keycloak.ts +5 -5
- package/src/login/KcContext/kcContextMocks.ts +4 -4
- package/src/login/i18n/i18n.tsx +4 -4
- package/src/login/i18n/useI18n.tsx +2 -11
- package/src/vite-plugin/vite-plugin.ts +8 -8
- package/vite-plugin/index.js +42 -42
@@ -1,22 +1,48 @@
|
|
1
|
-
<#assign
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
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
|
113
|
+
<#local keys = object?keys>
|
94
114
|
<#recover>
|
95
|
-
<#return "ABORT:
|
115
|
+
<#return "ABORT: We can't list keys on object">
|
96
116
|
</#attempt>
|
97
117
|
|
98
|
-
<#
|
118
|
+
<#local outSeq = []>
|
99
119
|
|
100
|
-
|
101
|
-
|
120
|
+
<#list keys as key>
|
121
|
+
<#if ["class","declaredConstructors","superclass","declaringClass" ]?seq_contains(key) >
|
122
|
+
<#continue>
|
102
123
|
</#if>
|
103
124
|
|
104
|
-
<#
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
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
|
-
|
123
|
-
|
124
|
-
|
125
|
-
key == "
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
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
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
)
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
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
|
-
|
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
|
-
|
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
|
234
|
-
<#continue>
|
233
|
+
<#local outSeq += ["/*Accessing attemptedUsername throwed an exception */"]>
|
235
234
|
</#attempt>
|
235
|
+
</#if>
|
236
236
|
|
237
|
-
|
237
|
+
{{userDefinedExclusions}}
|
238
238
|
|
239
|
-
|
240
|
-
|
241
|
-
<#recover>
|
242
|
-
<#local out_seq += ["/*Couldn't dereference '" + key + "' on this object*/"]>
|
239
|
+
<#attempt>
|
240
|
+
<#if !object[key]??>
|
243
241
|
<#continue>
|
244
|
-
</#
|
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
|
-
|
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
|
-
|
257
|
+
<#local recOut = toJsDeclarationString(propertyValue, path + [ key ])>
|
249
258
|
|
250
|
-
|
259
|
+
<#if recOut?starts_with("ABORT:")>
|
251
260
|
|
252
|
-
|
253
|
-
<#local out_seq += ["/*" + key + ": " + errorMessage + "*/"]>
|
254
|
-
</#if>
|
261
|
+
<#local errorMessage = recOut?remove_beginning("ABORT:")>
|
255
262
|
|
256
|
-
|
263
|
+
<#if errorMessage != " It's a method" >
|
264
|
+
<#local outSeq += ["/*" + key + ": " + errorMessage + "*/"]>
|
257
265
|
</#if>
|
258
266
|
|
259
|
-
<#
|
267
|
+
<#continue>
|
268
|
+
</#if>
|
260
269
|
|
261
|
-
|
270
|
+
<#local outSeq += ['"' + key + '": ' + recOut + ","]>
|
262
271
|
|
263
|
-
|
272
|
+
</#list>
|
264
273
|
|
265
|
-
|
274
|
+
<#return (["{"] + outSeq?map(str -> ""?right_pad(4 * (path?size + 1)) + str) + [ ""?right_pad(4 * path?size) + "}"])?join("\n")>
|
266
275
|
|
267
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
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
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
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
|
-
|
301
|
-
|
321
|
+
<#if areSamePath(path, ["totp", "policy", "getAlgorithmKey"])>
|
322
|
+
<#local returnValue = "error">
|
323
|
+
<#if mode?? && mode = "manual">
|
302
324
|
<#attempt>
|
303
|
-
<#local returnValue =
|
325
|
+
<#local returnValue = totp.policy.getAlgorithmKey()>
|
304
326
|
<#recover>
|
305
|
-
<#return "ABORT: Couldn't evaluate
|
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
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
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
|
-
<#
|
320
|
-
</#
|
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
|
-
|
343
|
+
<#if areSamePath(path, ["messagesPerField", "get"])>
|
337
344
|
|
338
|
-
|
339
|
-
<#if pageId == "login.ftl" >
|
345
|
+
<#local jsFunctionCode = "function (fieldName) { ">
|
340
346
|
|
341
|
-
|
347
|
+
<#list fieldNames as fieldName>
|
342
348
|
|
343
|
-
|
349
|
+
<#-- See: https://github.com/keycloakify/keycloakify/issues/217 -->
|
350
|
+
<#if xKeycloakify.pageId == "login.ftl" >
|
344
351
|
|
345
|
-
|
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
|
-
|
354
|
+
<#local jsFunctionCode += "if(fieldName === 'username' || fieldName === 'password' ){ ">
|
352
355
|
|
353
|
-
|
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
|
-
<#
|
357
|
-
<#continue>
|
358
|
-
</#if>
|
362
|
+
<#local jsFunctionCode += "} ">
|
359
363
|
|
364
|
+
<#continue>
|
360
365
|
</#if>
|
361
366
|
|
362
|
-
<#
|
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
|
-
|
371
|
+
</#if>
|
371
372
|
|
372
|
-
|
373
|
+
<#local jsFunctionCode += "if(fieldName === '" + fieldName + "'){ ">
|
373
374
|
|
374
|
-
<#
|
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
|
-
<#
|
381
|
+
<#local jsFunctionCode += "} ">
|
377
382
|
|
378
|
-
</#
|
383
|
+
</#list>
|
379
384
|
|
380
|
-
<#
|
385
|
+
<#local jsFunctionCode += "}">
|
381
386
|
|
382
|
-
|
387
|
+
<#return jsFunctionCode>
|
383
388
|
|
384
|
-
|
389
|
+
</#if>
|
385
390
|
|
386
|
-
|
387
|
-
<#if pageId == "login.ftl" >
|
388
|
-
<#if fieldName == "username">
|
391
|
+
<#if areSamePath(path, ["messagesPerField", "existsError"])>
|
389
392
|
|
390
|
-
|
393
|
+
<#local jsFunctionCode = "function (fieldName) { ">
|
391
394
|
|
392
|
-
|
393
|
-
<#local jsFunctionCode += "return true; ">
|
394
|
-
<#else>
|
395
|
-
<#local jsFunctionCode += "return false; ">
|
396
|
-
</#if>
|
395
|
+
<#list fieldNames as fieldName>
|
397
396
|
|
398
|
-
|
397
|
+
<#-- See: https://github.com/keycloakify/keycloakify/issues/217 -->
|
398
|
+
<#if xKeycloakify.pageId == "login.ftl" >
|
399
|
+
<#if fieldName == "username">
|
399
400
|
|
400
|
-
|
401
|
-
</#if>
|
401
|
+
<#local jsFunctionCode += "if(fieldName === 'username' || fieldName === 'password' ){ ">
|
402
402
|
|
403
|
-
<#if
|
404
|
-
<#
|
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
|
-
|
409
|
+
<#local jsFunctionCode += "} ">
|
409
410
|
|
410
|
-
|
411
|
-
<#local jsFunctionCode += 'return true; '>
|
412
|
-
<#else>
|
413
|
-
<#local jsFunctionCode += "return false; ">
|
411
|
+
<#continue>
|
414
412
|
</#if>
|
415
413
|
|
416
|
-
<#
|
414
|
+
<#if fieldName == "password">
|
415
|
+
<#continue>
|
416
|
+
</#if>
|
417
|
+
</#if>
|
418
|
+
|
419
|
+
<#local jsFunctionCode += "if(fieldName === '" + fieldName + "' ){ ">
|
417
420
|
|
418
|
-
|
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
|
-
|
429
|
+
</#list>
|
423
430
|
|
424
|
-
|
431
|
+
<#local jsFunctionCode += "}">
|
425
432
|
|
426
|
-
<#
|
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
|
-
<#
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
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
|
-
<#
|
449
|
-
|
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
|
-
|
455
|
+
<#if isBoolean>
|
456
|
+
<#return object?c>
|
457
|
+
</#if>
|
457
458
|
|
458
|
-
|
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
|
-
|
467
|
+
<#if isEnumerable>
|
463
468
|
|
464
|
-
|
465
|
-
<#local out_seq += ["null,"]>
|
466
|
-
<#continue>
|
467
|
-
</#if>
|
469
|
+
<#local outSeq = []>
|
468
470
|
|
469
|
-
|
471
|
+
<#local i = 0>
|
470
472
|
|
471
|
-
|
473
|
+
<#list object as array_item>
|
472
474
|
|
473
|
-
|
475
|
+
<#if !array_item??>
|
476
|
+
<#local outSeq += ["null,"]>
|
477
|
+
<#continue>
|
478
|
+
</#if>
|
474
479
|
|
475
|
-
|
480
|
+
<#local recOut = toJsDeclarationString(array_item, path + [ i ])>
|
476
481
|
|
477
|
-
|
478
|
-
<#local out_seq += ["/*" + i?string + ": " + errorMessage + "*/"]>
|
479
|
-
</#if>
|
482
|
+
<#local i = i + 1>
|
480
483
|
|
481
|
-
|
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
|
-
<#
|
492
|
+
<#continue>
|
493
|
+
</#if>
|
485
494
|
|
486
|
-
|
495
|
+
<#local outSeq += [recOut + ","]>
|
487
496
|
|
488
|
-
|
497
|
+
</#list>
|
489
498
|
|
490
|
-
|
499
|
+
<#return (["["] + outSeq?map(str -> ""?right_pad(4 * (path?size + 1)) + str) + [ ""?right_pad(4 * path?size) + "]"])?join("\n")>
|
491
500
|
|
492
|
-
|
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
|
-
|
500
|
-
|
501
|
-
|
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
|
-
|
504
|
-
<#
|
505
|
-
|
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
|
-
|
511
|
-
|
512
|
-
|
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
|
-
|
515
|
-
<#
|
516
|
-
|
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
|
-
|
522
|
-
|
523
|
-
|
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
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
532
|
+
<#if isString>
|
533
|
+
<@addToXKeycloakifyMessagesIfMessageKey str=object />
|
534
|
+
</#if>
|
535
|
+
|
536
|
+
<#attempt>
|
537
|
+
<#return '"' + object?js_string + '"'>;
|
538
|
+
<#recover>
|
539
|
+
</#attempt>
|
529
540
|
|
530
|
-
|
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
|
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
|
574
|
-
<#return path?size == searchedPath?size &&
|
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
|
-
<#
|
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
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
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
|
-
|