Merge pull request #128 from Ann2827/pull

Fix bugs on error.ftl template
This commit is contained in:
Joseph Garrone 2022-07-03 15:52:42 +02:00 committed by GitHub
commit 30315027c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,7 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
</#attempt>
"printIfExists": function (fieldName, x) {
<#if messagesPerField?? >
<#list fieldNames as fieldName>
if(fieldName === "${fieldName}" ){
<#attempt>
@ -39,8 +40,12 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
}
</#list>
throw new Error("There is no " + fieldName + " field");
<#else>
return undefined;
</#if>
},
"existsError": function (fieldName) {
<#if messagesPerField?? >
<#list fieldNames as fieldName>
if(fieldName === "${fieldName}" ){
<#attempt>
@ -50,8 +55,12 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
}
</#list>
throw new Error("There is no " + fieldName + " field");
<#else>
return false;
</#if>
},
"get": function (fieldName) {
<#if messagesPerField?? >
<#list fieldNames as fieldName>
if(fieldName === "${fieldName}" ){
<#attempt>
@ -63,8 +72,12 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
}
</#list>
throw new Error("There is no " + fieldName + " field");
<#else>
return '';
</#if>
},
"exists": function (fieldName) {
<#if messagesPerField?? >
<#list fieldNames as fieldName>
if(fieldName === "${fieldName}" ){
<#attempt>
@ -74,6 +87,9 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
}
</#list>
throw new Error("There is no " + fieldName + " field");
<#else>
return false;
</#if>
}
};
@ -137,6 +153,9 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
key == "identityProviderBrokerCtx" &&
are_same_path(path, []) &&
["login-idp-link-confirm.ftl", "login-idp-link-email.ftl" ]?seq_contains(pageId)
) || (
["masterAdminClient", "delegateForUpdate", "defaultRole"]?seq_contains(key) &&
are_same_path(path, ["realm"])
)
>
<#local out_seq += ["/*If you need '" + key + "' on " + pageId + ", please submit an issue to the Keycloakify repo*/"]>