Chr*_*mer 4 freemarker keycloak custom-theme keycloak-services error-messaging
因此,我使用 keycloak 作为身份验证机制,并通过修改 login.ftl 文件来自定义登录页面。到目前为止,一切都很好。我正在我的 login.ftl 中导入 template.ftl 文件 - 按照 keycloak 文档的指示 - 到目前为止一切顺利。在该 template.ftl 文件中 - 有一种方法可以访问错误消息,如下所示
<#if displayMessage && message?has_content && (message.type != 'warning' || !isAppInitiatedAction??)>
<div class="alert alert-${message.type}">
<#if message.type = 'success'><span class="${properties.kcFeedbackSuccessIcon!}"></span></#if>
<#if message.type = 'warning'><span class="${properties.kcFeedbackWarningIcon!}"></span></#if>
<#if message.type = 'error'><span class="${properties.kcFeedbackErrorIcon!}"></span></#if>
<#if message.type = 'info'><span class="${properties.kcFeedbackInfoIcon!}"></span></#if>
<span class="kc-feedback-text">${kcSanitize(message.summary)?no_esc}</span>
</div>
</#if>
Run Code Online (Sandbox Code Playgroud)
太好了!如果我不想处理 template.ftl 文件中的错误消息 ui 怎么办?我在login.ftl 页面上有一个表单UI,我想在其中显示错误消息。如何将该消息传递到login.ftl 文件或从login.ftl 文件访问该错误消息?预先感谢您的任何指导。
小智 6
您可以在 login.ftl 中访问它,就像在 template.ftl 中一样
<#if message?has_content>
message.summary
...
</#if>
Run Code Online (Sandbox Code Playgroud)
我认为您在 login.ftl 中未设置模板变量(displayMessage、isAppInitiatedAction)时遇到问题
| 归档时间: |
|
| 查看次数: |
9280 次 |
| 最近记录: |