Converts all functions without arguments at the same place in the ftl template

This commit is contained in:
Joseph Garrone 2024-05-14 03:30:27 +02:00
parent 497f747d69
commit 19f1b4b14e
2 changed files with 20 additions and 35 deletions

View File

@ -164,21 +164,6 @@ export declare namespace KcContext {
};
mode?: "qr" | "manual" | undefined | null;
isAppInitiatedAction: boolean;
url: {
accountUrl: string;
passwordUrl: string;
totpUrl: string;
socialUrl: string;
sessionsUrl: string;
applicationsUrl: string;
logUrl: string;
resourceUrl: string;
resourcesCommonPath: string;
resourcesPath: string;
/** @deprecated, not present in recent keycloak version apparently, use kcContext.referrer instead */
referrerURI?: string;
getLogoutUrl: () => string;
};
stateChecker: string;
};

View File

@ -249,26 +249,6 @@
}
};
<#if account??>
out["url"]["getLogoutUrl"] = function () {
<#attempt>
return "${url.getLogoutUrl()}";
<#recover>
throw new Error("Failed to invoke url.getLogoutUrl() in the FreeMarker template");
</#attempt>
};
</#if>
<#if pageId === "login-config-totp.ftl">
out["totp"]["policy"]["getAlgorithmKey"] = function () {
<#attempt>
return "${totp.policy.getAlgorithmKey()}";
<#recover>
throw new Error("Failed to invoke totp.policy.getAlgorithmKey() in the FreeMarker template");
</#attempt>
};
</#if>
out["keycloakifyVersion"] = "KEYCLOAKIFY_VERSION_xEdKd3xEdr";
out["themeVersion"] = "KEYCLOAKIFY_THEME_VERSION_sIgKd3xEdr3dx";
out["themeType"] = "KEYCLOAKIFY_THEME_TYPE_dExKd3xEdr";
@ -470,6 +450,26 @@
</#attempt>
</#if>
<#if are_same_path(path, ["url", "getLogoutUrl"])>
<#local returnValue = "">
<#attempt>
<#local returnValue = auth.getLogoutUrl()>
<#recover>
<#return "ABORT: Couldn't evaluate url.getLogoutUrl()">
</#attempt>
<#return 'function(){ return "' + returnValue + '"; }'>
</#if>
<#if are_same_path(path, ["totp", "policy", "getAlgorithmKey"])>
<#local returnValue = "">
<#attempt>
<#local returnValue = totp.policy.getAlgorithmKey()>
<#recover>
<#return "ABORT: Couldn't evaluate totp.policy.getAlgorithmKey()">
</#attempt>
<#return 'function(){ return "' + returnValue + '"; }'>
</#if>
<#return "ABORT: It's a method">
</#if>