fix: changes
This commit is contained in:
parent
804fe33665
commit
3d98860369
@ -1,181 +0,0 @@
|
|||||||
<script>const _=
|
|
||||||
<#macro objectToJson_please_ignore_errors object depth arr ftl>
|
|
||||||
<@compress>
|
|
||||||
<#local isHash = false>
|
|
||||||
<#attempt>
|
|
||||||
<#local isHash = object?is_hash || object?is_hash_ex>
|
|
||||||
<#recover>
|
|
||||||
/* can't evaluate if object is hash */
|
|
||||||
undefined
|
|
||||||
<#return>
|
|
||||||
</#attempt>
|
|
||||||
<#if isHash>
|
|
||||||
<#local keys = "">
|
|
||||||
<#attempt>
|
|
||||||
<#local keys = object?keys>
|
|
||||||
<#recover>
|
|
||||||
/* can't list keys of object */
|
|
||||||
undefined
|
|
||||||
<#return>
|
|
||||||
</#attempt>
|
|
||||||
<#if arr?sequence?size gte 1>
|
|
||||||
<#local keys = arr>
|
|
||||||
</#if>
|
|
||||||
{${'\n'}
|
|
||||||
<#list keys as key>
|
|
||||||
<#if key == "class">
|
|
||||||
/* skipping "class" property of object */
|
|
||||||
<#continue>
|
|
||||||
</#if>
|
|
||||||
<#attempt>
|
|
||||||
<#local value = object[key]!"error_data_is_undefined">
|
|
||||||
<#recover>
|
|
||||||
/* couldn't dereference ${key} of object */
|
|
||||||
<#continue>
|
|
||||||
</#attempt>
|
|
||||||
<#if depth gt 7>
|
|
||||||
/* Avoid calling recustively too many times depth: ${depth}, key: ${key} */
|
|
||||||
<#continue>
|
|
||||||
</#if>
|
|
||||||
<#local arr_keys = []>
|
|
||||||
<#if depth==0 && key=="url" && ftl=="saml-post-form.ftl" >
|
|
||||||
<#local arr_keys = ["resourcesPath", "resourcesCommonPath", "loginRestartFlowUrl", "loginUrl", "loginResetCredentialsUrl", "registrationUrl", "registrationAction", "oauth2DeviceVerificationAction", "oauthAction", "loginResetCredentialsUrl"]>
|
|
||||||
<#elseif depth==0 && key=="url">
|
|
||||||
<#local arr_keys = ["loginAction", "resourcesPath", "resourcesCommonPath", "loginRestartFlowUrl", "loginUrl", "loginResetCredentialsUrl", "registrationUrl", "registrationAction", "oauth2DeviceVerificationAction", "oauthAction", "loginResetCredentialsUrl"]>
|
|
||||||
</#if>
|
|
||||||
<#if depth==0 && key=="auth" && ftl=="login-reset-password.ftl" >
|
|
||||||
<#local arr_keys = ["showUsername", "showResetCredentials", "showTryAnotherWayLink", "attemptedUsername"]>
|
|
||||||
<#elseif depth==0 && key=="auth">
|
|
||||||
<#local arr_keys = ["showUsername", "showResetCredentials", "showTryAnotherWayLink"]>
|
|
||||||
</#if>
|
|
||||||
<#if depth==0 && key=="updateProfileCtx" ><#continue></#if>
|
|
||||||
"${key}": <@objectToJson_please_ignore_errors object=value depth=depth+1 arr=arr_keys ftl=ftl />,
|
|
||||||
</#list>
|
|
||||||
}${'\n'}
|
|
||||||
<#return>
|
|
||||||
</#if>
|
|
||||||
<#local isMethod = "">
|
|
||||||
<#attempt>
|
|
||||||
<#local isMethod = object?is_method>
|
|
||||||
<#recover>
|
|
||||||
/* can't test if object is a method */
|
|
||||||
undefined
|
|
||||||
<#return>
|
|
||||||
</#attempt>
|
|
||||||
<#if isMethod>
|
|
||||||
undefined
|
|
||||||
<#return>
|
|
||||||
</#if>
|
|
||||||
<#local isBoolean = "">
|
|
||||||
<#attempt>
|
|
||||||
<#local isBoolean = object?is_boolean>
|
|
||||||
<#recover>
|
|
||||||
/* can't test if object is a boolean */
|
|
||||||
undefined
|
|
||||||
<#return>
|
|
||||||
</#attempt>
|
|
||||||
<#if isBoolean>
|
|
||||||
${object?c}
|
|
||||||
<#return>
|
|
||||||
</#if>
|
|
||||||
<#local isEnumerable = "">
|
|
||||||
<#attempt>
|
|
||||||
<#local isEnumerable = object?is_enumerable>
|
|
||||||
<#recover>
|
|
||||||
/* can't test if object is enumerable */
|
|
||||||
undefined
|
|
||||||
<#return>
|
|
||||||
</#attempt>
|
|
||||||
<#if isEnumerable>
|
|
||||||
[${'\n'}
|
|
||||||
<#list object as item>
|
|
||||||
<@objectToJson_please_ignore_errors object=item depth=depth+1 arr=[] ftl=ftl/>,
|
|
||||||
</#list>
|
|
||||||
]${'\n'}
|
|
||||||
<#return>
|
|
||||||
</#if>
|
|
||||||
<#attempt>
|
|
||||||
"${object?replace('"', '\\"')?no_esc}"
|
|
||||||
<#recover>
|
|
||||||
/* couldn't convert into string non hash, non method, non boolean, non enumerable object */
|
|
||||||
undefined;
|
|
||||||
<#return>
|
|
||||||
</#attempt>
|
|
||||||
</@compress>
|
|
||||||
</#macro>
|
|
||||||
(()=>{
|
|
||||||
const nonAutomaticallyConvertible = {
|
|
||||||
"messagesPerField": {
|
|
||||||
<#assign fieldNames = ["global", "userLabel", "username", "email", "firstName", "lastName", "password", "password-confirm", "totp", "totpSecret", "SAMLRequest", "SAMLResponse", "relayState", "device_user_code", "code", "password-new", "rememberMe", "login", "authenticationExecution", "cancel-aia", "clientDataJSON", "authenticatorData", "signature", "credentialId", "userHandle", "error", "authn_use_chk", "authenticationExecution", "isSetRetry", "try-again", "attestationObject", "publicKeyCredentialId", "authenticatorLabel"]>
|
|
||||||
<#assign attributes = (profile.attributes)![]>
|
|
||||||
<#attempt>
|
|
||||||
<#list attributes as attribute>
|
|
||||||
<#if (attribute.name)??>
|
|
||||||
<#assign fieldNames += [attribute.name]>
|
|
||||||
</#if>
|
|
||||||
</#list>
|
|
||||||
<#recover>
|
|
||||||
</#attempt>
|
|
||||||
"printIfExists": function (fieldName, x) {
|
|
||||||
<#list fieldNames as fieldName>
|
|
||||||
if(fieldName === "${fieldName}" ){
|
|
||||||
<#attempt>
|
|
||||||
return "${messagesPerField.printIfExists(fieldName,'1')}" ? x : undefined;
|
|
||||||
<#recover>
|
|
||||||
</#attempt>
|
|
||||||
}
|
|
||||||
</#list>
|
|
||||||
throw new Error("There is no " + fieldName + " field");
|
|
||||||
},
|
|
||||||
"existsError": function (fieldName) {
|
|
||||||
<#list fieldNames as fieldName>
|
|
||||||
if(fieldName === "${fieldName}" ){
|
|
||||||
<#attempt>
|
|
||||||
return <#if messagesPerField.existsError('${fieldName}')>true<#else>false</#if>;
|
|
||||||
<#recover>
|
|
||||||
</#attempt>
|
|
||||||
}
|
|
||||||
</#list>
|
|
||||||
throw new Error("There is no " + fieldName + " field");
|
|
||||||
},
|
|
||||||
"get": function (fieldName) {
|
|
||||||
<#list fieldNames as fieldName>
|
|
||||||
if(fieldName === "${fieldName}" ){
|
|
||||||
<#attempt>
|
|
||||||
<#if messagesPerField.existsError('${fieldName}')>
|
|
||||||
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
|
||||||
</#if>
|
|
||||||
<#recover>
|
|
||||||
</#attempt>
|
|
||||||
}
|
|
||||||
</#list>
|
|
||||||
throw new Error("There is no " + fieldName + " field");
|
|
||||||
},
|
|
||||||
"exists": function (fieldName) {
|
|
||||||
<#list fieldNames as fieldName>
|
|
||||||
if(fieldName === "${fieldName}" ){
|
|
||||||
<#attempt>
|
|
||||||
return <#if messagesPerField.exists('${fieldName}')>true<#else>false</#if>;
|
|
||||||
<#recover>
|
|
||||||
</#attempt>
|
|
||||||
}
|
|
||||||
</#list>
|
|
||||||
throw new Error("There is no " + fieldName + " field");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"msg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); },
|
|
||||||
"advancedMsg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); }
|
|
||||||
};
|
|
||||||
const out = {};
|
|
||||||
Object.deepAssign(
|
|
||||||
out,
|
|
||||||
//Removing all the undefined
|
|
||||||
JSON.parse(JSON.stringify(<@objectToJson_please_ignore_errors object=.data_model depth=0 arr=[] ftl="ftl_template_for_replacement" />), (key, value) => value === "error_data_is_undefined" ? undefined : value)
|
|
||||||
);
|
|
||||||
Object.deepAssign(
|
|
||||||
out,
|
|
||||||
nonAutomaticallyConvertible
|
|
||||||
);
|
|
||||||
return out;
|
|
||||||
})()
|
|
||||||
</script>
|
|
@ -1,8 +1,8 @@
|
|||||||
<script>const _=
|
<script>const _=
|
||||||
<#assign pageId="PAGE_ID_xIgLsPgGId9D8e">
|
<#assign pageId="PAGE_ID_xIgLsPgGId9D8e">
|
||||||
(()=>{
|
(()=>{
|
||||||
|
|
||||||
const out =
|
const out =
|
||||||
${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
||||||
|
|
||||||
out["msg"]= function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); };
|
out["msg"]= function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); };
|
||||||
@ -11,12 +11,12 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|||||||
out["messagesPerField"]= {
|
out["messagesPerField"]= {
|
||||||
<#assign fieldNames = [
|
<#assign fieldNames = [
|
||||||
"global", "userLabel", "username", "email", "firstName", "lastName", "password", "password-confirm",
|
"global", "userLabel", "username", "email", "firstName", "lastName", "password", "password-confirm",
|
||||||
"totp", "totpSecret", "SAMLRequest", "SAMLResponse", "relayState", "device_user_code", "code",
|
"totp", "totpSecret", "SAMLRequest", "SAMLResponse", "relayState", "device_user_code", "code",
|
||||||
"password-new", "rememberMe", "login", "authenticationExecution", "cancel-aia", "clientDataJSON",
|
"password-new", "rememberMe", "login", "authenticationExecution", "cancel-aia", "clientDataJSON",
|
||||||
"authenticatorData", "signature", "credentialId", "userHandle", "error", "authn_use_chk", "authenticationExecution",
|
"authenticatorData", "signature", "credentialId", "userHandle", "error", "authn_use_chk", "authenticationExecution",
|
||||||
"isSetRetry", "try-again", "attestationObject", "publicKeyCredentialId", "authenticatorLabel"
|
"isSetRetry", "try-again", "attestationObject", "publicKeyCredentialId", "authenticatorLabel"
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<#attempt>
|
<#attempt>
|
||||||
<#if profile?? && profile.attributes?? && profile.attributes?is_enumerable>
|
<#if profile?? && profile.attributes?? && profile.attributes?is_enumerable>
|
||||||
<#list profile.attributes as attribute>
|
<#list profile.attributes as attribute>
|
||||||
@ -28,7 +28,7 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|||||||
</#if>
|
</#if>
|
||||||
<#recover>
|
<#recover>
|
||||||
</#attempt>
|
</#attempt>
|
||||||
|
|
||||||
"printIfExists": function (fieldName, x) {
|
"printIfExists": function (fieldName, x) {
|
||||||
<#list fieldNames as fieldName>
|
<#list fieldNames as fieldName>
|
||||||
if(fieldName === "${fieldName}" ){
|
if(fieldName === "${fieldName}" ){
|
||||||
@ -114,17 +114,17 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|||||||
<#continue>
|
<#continue>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#if
|
<#if
|
||||||
(
|
(
|
||||||
["loginUpdatePasswordUrl", "loginUpdateProfileUrl", "loginUsernameReminderUrl", "loginUpdateTotpUrl"]?seq_contains(key) &&
|
["loginUpdatePasswordUrl", "loginUpdateProfileUrl", "loginUsernameReminderUrl", "loginUpdateTotpUrl"]?seq_contains(key) &&
|
||||||
are_same_path(path, ["url"])
|
are_same_path(path, ["url"])
|
||||||
) || (
|
) || (
|
||||||
key == "updateProfileCtx" &&
|
key == "updateProfileCtx" &&
|
||||||
are_same_path(path, [])
|
are_same_path(path, [])
|
||||||
) || (
|
) || (
|
||||||
<#-- https://github.com/InseeFrLab/keycloakify/pull/65#issuecomment-991896344 -->
|
<#-- https://github.com/InseeFrLab/keycloakify/pull/65#issuecomment-991896344 -->
|
||||||
key == "loginAction" &&
|
key == "loginAction" &&
|
||||||
are_same_path(path, ["url"]) &&
|
are_same_path(path, ["url"]) &&
|
||||||
pageId == "saml-post-form.ftl"
|
pageId == "saml-post-form.ftl"
|
||||||
)
|
)
|
||||||
>
|
>
|
||||||
@ -144,6 +144,15 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|||||||
|
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
|
<#if
|
||||||
|
["contextData", "idpConfig", "idp", "authenticationSession"]?seq_contains(key) &&
|
||||||
|
are_same_path(path, ["brokerContext"])
|
||||||
|
>
|
||||||
|
<#continue>
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
<#if key == "identityProviderBrokerCtx" && are_same_path(path, []) ><#continue></#if>
|
||||||
|
|
||||||
<#attempt>
|
<#attempt>
|
||||||
<#if !object[key]??>
|
<#if !object[key]??>
|
||||||
<#continue>
|
<#continue>
|
||||||
@ -287,4 +296,4 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|||||||
<#return true>
|
<#return true>
|
||||||
|
|
||||||
</#function>
|
</#function>
|
||||||
</script>
|
</script>
|
Loading…
x
Reference in New Issue
Block a user