2

I'm using Keycloak as an authentication for a React app and customizing the login page by modifying the login.ftl file. I'm importing the template.ftl file in my login.ftl, according to Keycloak's docs, and everything works fine. Inside the template.ftl file, I can access template variables like so,

<#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>

With that in mind, is there a way to access a template variable in the template.ftl or login.ftl file that will give information that a session has just ended or a user was redirected to the login page because they just logged out? When a user gets redirected to the login page after logging out, I want to display a message UI either in the template.ftl or login.ftl that a user has just logged out.

Vy Do
  • 46,709
  • 59
  • 215
  • 313
KenNguyen
  • 21
  • 2

0 Answers0