Fix ftl error related to url.loginAction in saml-post-form.ftl

This commit is contained in:
garronej
2021-12-12 20:17:50 +01:00
parent 86ab9f72a5
commit a8623d8066
2 changed files with 11 additions and 6 deletions

View File

@ -1,4 +1,5 @@
<script>const _= <script>const _=
<#assign pageId="PAGE_ID_xIgLsPgGId9D8e">
(()=>{ (()=>{
const out = const out =
@ -76,6 +77,8 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
} }
}; };
out["pageId"] = "${pageId}";
return out; return out;
})() })()
@ -111,7 +114,6 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
<#continue> <#continue>
</#if> </#if>
<#-- Skip values that are known to throw sometime and that are used nowhere in the base Keycloak template -->
<#if <#if
( (
["loginUpdatePasswordUrl", "loginUpdateProfileUrl", "loginUsernameReminderUrl", "loginUpdateTotpUrl"]?seq_contains(key) && ["loginUpdatePasswordUrl", "loginUpdateProfileUrl", "loginUsernameReminderUrl", "loginUpdateTotpUrl"]?seq_contains(key) &&
@ -119,9 +121,14 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
) || ( ) || (
key == "updateProfileCtx" && key == "updateProfileCtx" &&
are_same_path(path, []) are_same_path(path, [])
) || (
<#-- https://github.com/InseeFrLab/keycloakify/pull/65#issuecomment-991896344 -->
key == "loginAction" &&
are_same_path(path, ["url"]) &&
pageId == "saml-post-form.ftl"
) )
> >
<#local out_seq += ["/*If you need '" + key + "' please submit an issue to the Keycloakify repo*/"]> <#local out_seq += ["/*If you need '" + key + "' on " + pageId + ", please submit an issue to the Keycloakify repo*/"]>
<#continue> <#continue>
</#if> </#if>

View File

@ -87,8 +87,6 @@ export function generateFtlFilesCodeFactory(params: {
].join("\n"), ].join("\n"),
}; };
const pageIdSearchValue = "PAGE_ID_xIgLsPgGId9D8e";
$("head").prepend( $("head").prepend(
[ [
...(Object.keys(cssGlobalsToDefine).length === 0 ...(Object.keys(cssGlobalsToDefine).length === 0
@ -105,7 +103,6 @@ export function generateFtlFilesCodeFactory(params: {
]), ]),
"<script>", "<script>",
` window.${ftlValuesGlobalName}= ${objectKeys(replaceValueBySearchValue)[0]};`, ` window.${ftlValuesGlobalName}= ${objectKeys(replaceValueBySearchValue)[0]};`,
` window.${ftlValuesGlobalName}["pageId"]= "${pageIdSearchValue}";`,
"</script>", "</script>",
"", "",
objectKeys(replaceValueBySearchValue)[1], objectKeys(replaceValueBySearchValue)[1],
@ -125,7 +122,8 @@ export function generateFtlFilesCodeFactory(params: {
Object.entries({ Object.entries({
...replaceValueBySearchValue, ...replaceValueBySearchValue,
[pageIdSearchValue]: pageId, //If updated, don't forget to change in the ftl script as well.
"PAGE_ID_xIgLsPgGId9D8e": pageId,
}).map(([searchValue, replaceValue]) => (ftlCode = ftlCode.replace(searchValue, replaceValue))); }).map(([searchValue, replaceValue]) => (ftlCode = ftlCode.replace(searchValue, replaceValue)));
return { ftlCode }; return { ftlCode };