A question about building the FTL files
See original GitHub issueHope you don’t mind the question, I wasn’t sure where else to ask it.
As part of the “build” process, you are attaching variables on to a global object called kcContext
(window.kcContext
).
This is fine and works great.
As part of my task I have to migrate not only the login related pages, but also account pages as well. For example, I have an account page that allows the user to change their email address. Here is the code that links the user to that page;
<@inputs.input id="username" name="username" type="text" value="${(account.email!'')}" class="input_withOption" disabled="true" labelText="Email address" hasOption="true">
<@buttons.link href="${email.emailPage}" class="inputOption inputOption__link" importance="tertiary" gaId="updateLoginDetails_changeEmailButton">Change</@buttons.link>
</@inputs.input>
We display the email address and provide a “Change” link. We pre-populate the email address field with the email they used for their account.
The account
object is provided I believe from Keycloak. Currently it is not exposed by Keycloakify, even though I assume it is available.
So I was looking at this code;
<script>
Object.deepAssign(
window.kcContext,
{ "pageId": "login-reset-password.ftl" }
);
Object.deepAssign(
window.kcContext,
{
"realm": {
"loginWithEmailAllowed": (function (){
<#attempt>
return ${realm.loginWithEmailAllowed?c};
<#recover>
</#attempt>
})()
}
}
);
</script>
Specifically this;
<#attempt>
return ${realm.loginWithEmailAllowed?c};
<#recover>
</#attempt>
This is compiled by keycloakfiy.
Is there any way I can easily extend the build process so that I can output my own variables?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
@garronej thanks for the response! I’m happy to help out and contribute back to this library, as its heavily relied upon in our project. I’ll probably fork the project, add in the functionality that I need and try and come up with a good generic solution that I can contribute back.
All the best! Great project btw, good work!
It is not currently scheduled but this is something I would like to get in eventually.
What is coming next is the support for customising
email
. It’s very much possible that it unlock the possibility of customising account at the same time.