From 5dd184eea8e81391694c89084ecc5485b63cd008 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Mon, 8 Jul 2024 13:59:19 +0200 Subject: [PATCH 1/4] Added template overrides fixes: #31021 Signed-off-by: Erik Jan de Wit --- .../login-recovery-authn-code-config.ftl | 192 ++++++++++++++++++ .../login/resources/css/styles.css | 7 + .../login/select-authenticator.ftl | 36 ++++ 3 files changed, 235 insertions(+) create mode 100644 themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl create mode 100644 themes/src/main/resources/theme/keycloak.v2/login/select-authenticator.ftl diff --git a/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl b/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl new file mode 100644 index 000000000000..ea1e459dc255 --- /dev/null +++ b/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl @@ -0,0 +1,192 @@ +<#import "template.ftl" as layout> +<#import "password-commons.ftl" as passwordCommons> +<@layout.registrationLayout; section> + +<#if section = "header"> + ${msg("recovery-code-config-header")} +<#elseif section = "form"> + +
+
+ +
+

+ Warning alert: + ${msg("recovery-code-config-warning-title")} +

+
+

${msg("recovery-code-config-warning-message")}

+
+
+ +
+
+
+
    + <#list recoveryAuthnCodesConfigBean.generatedRecoveryAuthnCodesList as code> +
  1. ${code[0..3]}-${code[4..7]}-${code[8..]}
  2. + +
+
+
+
+ + +
+ + + +
+ + +
+ + +
+ +
+ + + +<@passwordCommons.logoutOtherSessions/> + +<#if isAppInitiatedAction??> + + +<#else> + + +
+ + + + diff --git a/themes/src/main/resources/theme/keycloak.v2/login/resources/css/styles.css b/themes/src/main/resources/theme/keycloak.v2/login/resources/css/styles.css index 9e816fcf7d0b..2481ddbf264b 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/resources/css/styles.css +++ b/themes/src/main/resources/theme/keycloak.v2/login/resources/css/styles.css @@ -69,3 +69,10 @@ div.kc-logo-text span { border-color: transparent black transparent transparent; } +.kc-recovery-codes-list { + columns: 2; +} + +#certificate_subjectDN { + overflow-wrap: break-word +} \ No newline at end of file diff --git a/themes/src/main/resources/theme/keycloak.v2/login/select-authenticator.ftl b/themes/src/main/resources/theme/keycloak.v2/login/select-authenticator.ftl new file mode 100644 index 000000000000..f14db8e929a8 --- /dev/null +++ b/themes/src/main/resources/theme/keycloak.v2/login/select-authenticator.ftl @@ -0,0 +1,36 @@ +<#import "template.ftl" as layout> +<@layout.registrationLayout displayInfo=false; section> + <#if section = "header" || section = "show-username"> + <#if section = "header"> + ${msg("loginChooseAuthenticator")} + + <#elseif section = "form"> + +
+
    + <#list auth.authenticationSelections as authenticationSelection> +
  • +
    +
    +
    + +
    +
    +

    ${msg('${authenticationSelection.displayName}')}

    +
    +
    + ${msg('${authenticationSelection.helpText}')} +
    +
    +
    + +
    +
    +
  • + +
+
+ + + + From 90f334770bb220dd668fb51dd6d9fdc718c0c4de Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Tue, 9 Jul 2024 12:26:58 +0200 Subject: [PATCH 2/4] pr review comment Signed-off-by: Erik Jan de Wit --- .../login-recovery-authn-code-config.ftl | 342 +++++++++--------- 1 file changed, 174 insertions(+), 168 deletions(-) diff --git a/themes/src/main/resources/theme/base/login/login-recovery-authn-code-config.ftl b/themes/src/main/resources/theme/base/login/login-recovery-authn-code-config.ftl index c664fc70766d..c6be951abf1c 100644 --- a/themes/src/main/resources/theme/base/login/login-recovery-authn-code-config.ftl +++ b/themes/src/main/resources/theme/base/login/login-recovery-authn-code-config.ftl @@ -5,182 +5,188 @@ <#if section = "header"> ${msg("recovery-code-config-header")} <#elseif section = "form"> - -
-
- -
-

- Warning alert: - ${msg("recovery-code-config-warning-title")} -

-
-

${msg("recovery-code-config-warning-message")}

-
-
- -
    - <#list recoveryAuthnCodesConfigBean.generatedRecoveryAuthnCodesList as code> -
  1. ${code?counter}: ${code[0..3]}-${code[4..7]}-${code[8..]}
  2. + +
    +
    + +
    +

    + Warning alert: + ${msg("recovery-code-config-warning-title")} +

    +
    +

    ${msg("recovery-code-config-warning-message")}

    +
    +
    + +
    +
    +
    +
      + <#list recoveryAuthnCodesConfigBean.generatedRecoveryAuthnCodesList as code> +
    1. ${code[0..3]}-${code[4..7]}-${code[8..]}
    +
    +
    +
    - -
    - - - -
    - - -
    - - -
    - -
    - - - - <@passwordCommons.logoutOtherSessions/> - - <#if isAppInitiatedAction??> - - + + + + + +
    + + +
    + + + + + +<@passwordCommons.logoutOtherSessions/> + +<#if isAppInitiatedAction??> + + <#else> - -
    +id="saveRecoveryAuthnCodesBtn" value="${msg("recovery-codes-action-complete")}" +disabled +/> + + - - - + var recoveryCodeList = ""; + + for (var i = 0; i < recoveryCodes.length; i++) { + var recoveryCodeLiElement = recoveryCodes[i].innerText; + recoveryCodeList += recoveryCodeLiElement + "\r\n"; + } + + return recoveryCodeList; +} + +function buildDownloadContent() { + var recoveryCodeList = parseRecoveryCodeList(); + var dt = new Date(); + var options = { + month: 'long', + day: 'numeric', + year: 'numeric', + hour: 'numeric', + minute: 'numeric', + timeZoneName: 'short' + }; + + return fileBodyContent = + "${msg("recovery-codes-download-file-header")}\n\n" + + recoveryCodeList + "\n" + + "${msg("recovery-codes-download-file-description")}\n\n" + + "${msg("recovery-codes-download-file-date")} " + formatCurrentDateTime(); +} + +function setUpDownloadLinkAndDownload(filename, text) { + var el = document.createElement('a'); + el.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); + el.setAttribute('download', filename); + el.style.display = 'none'; + document.body.appendChild(el); + el.click(); + document.body.removeChild(el); +} + +function downloadRecoveryCodes() { + setUpDownloadLinkAndDownload('kc-download-recovery-codes.txt', buildDownloadContent()); +} + +var downloadButton = document.getElementById("downloadRecoveryCodes"); +downloadButton && downloadButton.addEventListener("click", downloadRecoveryCodes); + +/* print recovery codes */ +function buildPrintContent() { + var recoveryCodeListHTML = document.getElementById('kc-recovery-codes-list').innerHTML; + var styles = + `@page { size: auto; margin-top: 0; } + body { width: 480px; } + div { list-style-type: none; font-family: monospace } + p:first-of-type { margin-top: 48px }`; + + return printFileContent = + "" + + "Codestin Search App" + + "

    ${msg("recovery-codes-download-file-header")}

    " + + "
    " + recoveryCodeListHTML + "
    " + + "

    ${msg("recovery-codes-download-file-description")}

    " + + "

    ${msg("recovery-codes-download-file-date")} " + formatCurrentDateTime() + "

    " + + ""; +} + +function printRecoveryCodes() { + var w = window.open(); + w.document.write(buildPrintContent()); + w.print(); + w.close(); +} + +var printButton = document.getElementById("printRecoveryCodes"); +printButton && printButton.addEventListener("click", printRecoveryCodes); + + + From cada1ae10ffad90ddb57b8261aac071044d59399 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Mon, 15 Jul 2024 12:18:50 +0200 Subject: [PATCH 3/4] * removed duplicated javascript and fixed formatting * addressed PR comments Signed-off-by: Erik Jan de Wit --- .../login-recovery-authn-code-config.ftl | 342 +++++++++-------- .../login-recovery-authn-code-config.ftl | 353 +++++++++--------- .../login/resources/css/styles.css | 2 +- 3 files changed, 339 insertions(+), 358 deletions(-) diff --git a/themes/src/main/resources/theme/base/login/login-recovery-authn-code-config.ftl b/themes/src/main/resources/theme/base/login/login-recovery-authn-code-config.ftl index c6be951abf1c..c664fc70766d 100644 --- a/themes/src/main/resources/theme/base/login/login-recovery-authn-code-config.ftl +++ b/themes/src/main/resources/theme/base/login/login-recovery-authn-code-config.ftl @@ -5,188 +5,182 @@ <#if section = "header"> ${msg("recovery-code-config-header")} <#elseif section = "form"> - -
    -
    - -
    -

    - Warning alert: - ${msg("recovery-code-config-warning-title")} -

    -
    -

    ${msg("recovery-code-config-warning-message")}

    -
    -
    - -
    -
    -
    -
      - <#list recoveryAuthnCodesConfigBean.generatedRecoveryAuthnCodesList as code> -
    1. ${code[0..3]}-${code[4..7]}-${code[8..]}
    2. + +
      +
      + +
      +

      + Warning alert: + ${msg("recovery-code-config-warning-title")} +

      +
      +

      ${msg("recovery-code-config-warning-message")}

      +
      +
      + +
        + <#list recoveryAuthnCodesConfigBean.generatedRecoveryAuthnCodesList as code> +
      1. ${code?counter}: ${code[0..3]}-${code[4..7]}-${code[8..]}
      -
    -
    -
    - -
    - - - -
    - - -
    - - -
    - -
    - - - -<@passwordCommons.logoutOtherSessions/> - -<#if isAppInitiatedAction??> - - + + + + + +
    + + +
    + + + + + + <@passwordCommons.logoutOtherSessions/> + + <#if isAppInitiatedAction??> + + <#else> - -
    + id="saveRecoveryAuthnCodesBtn" value="${msg("recovery-codes-action-complete")}" + disabled + /> + + - - - + var recoveryCodeList = ""; + + for (var i = 0; i < recoveryCodes.length; i++) { + var recoveryCodeLiElement = recoveryCodes[i].innerText; + recoveryCodeList += recoveryCodeLiElement + "\r\n"; + } + + return recoveryCodeList; + } + + function buildDownloadContent() { + var recoveryCodeList = parseRecoveryCodeList(); + var dt = new Date(); + var options = { + month: 'long', + day: 'numeric', + year: 'numeric', + hour: 'numeric', + minute: 'numeric', + timeZoneName: 'short' + }; + + return fileBodyContent = + "${msg("recovery-codes-download-file-header")}\n\n" + + recoveryCodeList + "\n" + + "${msg("recovery-codes-download-file-description")}\n\n" + + "${msg("recovery-codes-download-file-date")} " + formatCurrentDateTime(); + } + + function setUpDownloadLinkAndDownload(filename, text) { + var el = document.createElement('a'); + el.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); + el.setAttribute('download', filename); + el.style.display = 'none'; + document.body.appendChild(el); + el.click(); + document.body.removeChild(el); + } + + function downloadRecoveryCodes() { + setUpDownloadLinkAndDownload('kc-download-recovery-codes.txt', buildDownloadContent()); + } + + var downloadButton = document.getElementById("downloadRecoveryCodes"); + downloadButton && downloadButton.addEventListener("click", downloadRecoveryCodes); + + /* print recovery codes */ + function buildPrintContent() { + var recoveryCodeListHTML = document.getElementById('kc-recovery-codes-list').innerHTML; + var styles = + `@page { size: auto; margin-top: 0; } + body { width: 480px; } + div { list-style-type: none; font-family: monospace } + p:first-of-type { margin-top: 48px }`; + + return printFileContent = + "" + + "Codestin Search App" + + "

    ${msg("recovery-codes-download-file-header")}

    " + + "
    " + recoveryCodeListHTML + "
    " + + "

    ${msg("recovery-codes-download-file-description")}

    " + + "

    ${msg("recovery-codes-download-file-date")} " + formatCurrentDateTime() + "

    " + + ""; + } + + function printRecoveryCodes() { + var w = window.open(); + w.document.write(buildPrintContent()); + w.print(); + w.close(); + } + + var printButton = document.getElementById("printRecoveryCodes"); + printButton && printButton.addEventListener("click", printRecoveryCodes); + + + diff --git a/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl b/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl index ea1e459dc255..e895cf137fbd 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl @@ -3,190 +3,177 @@ <@layout.registrationLayout; section> <#if section = "header"> - ${msg("recovery-code-config-header")} + ${msg("recovery-code-config-header")} <#elseif section = "form"> - -
    -
    - -
    -

    - Warning alert: - ${msg("recovery-code-config-warning-title")} -

    -
    -

    ${msg("recovery-code-config-warning-message")}

    -
    -
    - -
    -
    -
    -
      - <#list recoveryAuthnCodesConfigBean.generatedRecoveryAuthnCodesList as code> -
    1. ${code[0..3]}-${code[4..7]}-${code[8..]}
    2. - -
    -
    -
    + +
    +
    +
    - - -
    - - - -
    - - -
    - - -
    - -
    - - - -<@passwordCommons.logoutOtherSessions/> - -<#if isAppInitiatedAction??> - - -<#else> - + Warning alert: + ${msg("recovery-code-config-warning-title")} + +
    +

    ${msg("recovery-code-config-warning-message")}

    +
    +
    + +
    +
    +
    +
      + <#list recoveryAuthnCodesConfigBean.generatedRecoveryAuthnCodesList as code> +
    1. ${code[0..3]}-${code[4..7]}-${code[8..]}
    2. + +
    +
    +
    +
    + + +
    + + + +
    + + +
    + + +
    + + + + + + <@passwordCommons.logoutOtherSessions/> + + <#if isAppInitiatedAction??> + + + <#else> + - - - - - + + + + + diff --git a/themes/src/main/resources/theme/keycloak.v2/login/resources/css/styles.css b/themes/src/main/resources/theme/keycloak.v2/login/resources/css/styles.css index 2481ddbf264b..3d58c96acb78 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/resources/css/styles.css +++ b/themes/src/main/resources/theme/keycloak.v2/login/resources/css/styles.css @@ -69,7 +69,7 @@ div.kc-logo-text span { border-color: transparent black transparent transparent; } -.kc-recovery-codes-list { +#kc-recovery-codes-list { columns: 2; } From 977eaa85a2f8d07f44aecc5edacf3c5f95b8a25f Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Thu, 15 Aug 2024 11:55:56 +0200 Subject: [PATCH 4/4] added properties for classes Signed-off-by: Erik Jan de Wit --- .../login-recovery-authn-code-config.ftl | 22 ++++----- .../login/select-authenticator.ftl | 45 ++++++++++--------- .../theme/keycloak.v2/login/theme.properties | 18 +++++++- 3 files changed, 52 insertions(+), 33 deletions(-) diff --git a/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl b/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl index e895cf137fbd..30c9d9a084cd 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-config.ftl @@ -6,23 +6,23 @@ ${msg("recovery-code-config-header")} <#elseif section = "form"> -
    -
    +
    +
    -

    +

    Warning alert: ${msg("recovery-code-config-warning-title")}

    -
    +

    ${msg("recovery-code-config-warning-message")}

    -
    -
    -
    -
      +
      +
      +
      +
        <#list recoveryAuthnCodesConfigBean.generatedRecoveryAuthnCodesList as code>
      1. ${code[0..3]}-${code[4..7]}-${code[8..]}
      2. @@ -33,13 +33,13 @@
        - - -
        diff --git a/themes/src/main/resources/theme/keycloak.v2/login/select-authenticator.ftl b/themes/src/main/resources/theme/keycloak.v2/login/select-authenticator.ftl index f14db8e929a8..4117018ddd30 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/select-authenticator.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/select-authenticator.ftl @@ -6,30 +6,33 @@ <#elseif section = "form"> -
        -
          - <#list auth.authenticationSelections as authenticationSelection> -
        • -
          -
          -
          - -
          -
          -

          ${msg('${authenticationSelection.displayName}')}

          -
          -
          - ${msg('${authenticationSelection.helpText}')} -
          +
            + <#list auth.authenticationSelections as authenticationSelection> +
          • + + +
          • +
            +
            +
            +
            -
            - +
            +

            + ${msg('${authenticationSelection.displayName}')} +

            +
            + ${msg('${authenticationSelection.helpText}')} +
            +
            +
            +
            - - -
          - +
          +
        • + +
        diff --git a/themes/src/main/resources/theme/keycloak.v2/login/theme.properties b/themes/src/main/resources/theme/keycloak.v2/login/theme.properties index 7dc49dc6dc8d..c684fcc4bd26 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/theme.properties +++ b/themes/src/main/resources/theme/keycloak.v2/login/theme.properties @@ -11,10 +11,18 @@ kcInputGroup=pf-v5-c-input-group kcInputErrorMessageClass=pf-v5-c-helper-text__item pf-m-error pf-v5-c-form__label-required kc-feedback-text kcAlertClass=pf-v5-c-alert pf-m-inline +kcAlertIconClass=pf-v5-c-alert__icon kcAlertTitleClass=pf-v5-c-alert__title +kcAlertDescriptionClass=pf-v5-c-alert__description kcFormPasswordVisibilityButtonClass=pf-v5-c-button pf-m-control +kcPanelClass=pf-v5-c-panel pf-m-raised +kcPanelMainClass=pf-v5-c-panel__main +kcPanelMainBodyClass=pf-v5-c-panel__main-body +kcListClass=pf-v5-c-list + kcButtonClass=pf-v5-c-button +kcButtonLinkClass=pf-v5-c-button pf-m-link kcCommonLogoIdP=pf-v5-c-login__main-footer-links-item kcFormSocialAccountListClass=pf-v5-c-login__main-footer-links kcFormSocialAccountListItemClass=pf-v5-c-login__main-footer-links-item @@ -28,5 +36,13 @@ kcFormCardClass=card-pf kcResetFlowIcon=pf-icon fas fa-share-square -kcSelectAuthListItemClass= pf-v5-c-data-list__item pf-m-clickable select-auth-box-parent +kcSelectAuthListClass=pf-v5-c-data-list select-auth-container +kcSelectAuthListItemWrapperClass=pf-v5-c-data-list__item pf-m-clickable +kcSelectAuthListItemClass=pf-v5-c-data-list__item-row select-auth-box-parent kcSelectAuthListItemHeadingClass=pf-v5-u-font-family-heading select-auth-box-headline +kcSelectAuthListItemBodyClass=pf-v5-c-data-list__cell pf-m-no-fill +kcSelectAuthListItemIconClass=pf-v5-c-data-list__cell pf-m-icon select-auth-box-icon +kcSelectAuthListItemFillClass=pf-v5-c-data-list__item-action +kcSelectAuthListItemDescriptionClass=pf-v5-c-data-list__cell pf-m-no-fill select-auth-box-desc + +kcRecoveryCodesWarning=pf-v5-c-alert pf-m-warning pf-m-inline pf-v5-u-mb-md kc-recovery-codes-warning \ No newline at end of file