From 927a02ec5da1570101cbc5e6aaeca0bb08f3cc38 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Wed, 4 Sep 2024 18:30:34 +0200 Subject: [PATCH] some more ui fixes (#32661) towards: #32522 Signed-off-by: Erik Jan de Wit --- .../theme/keycloak.v2/login/buttons.ftl | 6 ++-- .../keycloak.v2/login/login-config-totp.ftl | 1 + .../keycloak.v2/login/login-password.ftl | 31 +++++++++++++++++++ .../login-recovery-authn-code-config.ftl | 7 +++-- .../login/login-recovery-authn-code-input.ftl | 15 +++++++++ .../login/login-update-password.ftl | 1 - .../keycloak.v2/login/login-username.ftl | 2 ++ .../theme/keycloak.v2/login/login.ftl | 3 +- .../theme/keycloak.v2/login/register.ftl | 3 +- .../login/resources/css/styles.css | 5 +++ .../login/select-authenticator.ftl | 2 ++ .../theme/keycloak.v2/login/template.ftl | 2 ++ .../theme/keycloak.v2/login/theme.properties | 9 +++--- .../login/webauthn-authenticate.ftl | 2 ++ 14 files changed, 76 insertions(+), 13 deletions(-) create mode 100755 themes/src/main/resources/theme/keycloak.v2/login/login-password.ftl create mode 100644 themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-input.ftl diff --git a/themes/src/main/resources/theme/keycloak.v2/login/buttons.ftl b/themes/src/main/resources/theme/keycloak.v2/login/buttons.ftl index 764bdc8f50..f37c8f9105 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/buttons.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/buttons.ftl @@ -5,12 +5,12 @@ -<#macro button id name label class="kcButtonPrimaryClass"> - +<#macro button id name label class=["kcButtonPrimaryClass"]> + <#macro loginButton> <@buttons.actionGroup> - <@buttons.button id="kc-login" name="login" label="doLogIn"/> + <@buttons.button id="kc-login" name="login" label="doLogIn" class=["kcButtonPrimaryClass", "kcButtonBlockClass"] /> \ No newline at end of file diff --git a/themes/src/main/resources/theme/keycloak.v2/login/login-config-totp.ftl b/themes/src/main/resources/theme/keycloak.v2/login/login-config-totp.ftl index 7a7ad57d14..0a36fa6099 100755 --- a/themes/src/main/resources/theme/keycloak.v2/login/login-config-totp.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/login-config-totp.ftl @@ -2,6 +2,7 @@ <#import "field.ftl" as field> <#import "password-commons.ftl" as passwordCommons> <@layout.registrationLayout displayRequiredFields=false displayMessage=!messagesPerField.existsError('totp','userLabel'); section> + <#if section = "header"> ${msg("loginTotpTitle")} diff --git a/themes/src/main/resources/theme/keycloak.v2/login/login-password.ftl b/themes/src/main/resources/theme/keycloak.v2/login/login-password.ftl new file mode 100755 index 0000000000..141569e39d --- /dev/null +++ b/themes/src/main/resources/theme/keycloak.v2/login/login-password.ftl @@ -0,0 +1,31 @@ +<#import "template.ftl" as layout> +<#import "field.ftl" as field> +<#import "buttons.ftl" as buttons> +<@layout.registrationLayout displayMessage=!messagesPerField.existsError('password'); section> + + <#if section = "header"> + ${msg("doLogIn")} + <#elseif section = "form"> +
+
+
+ <@field.password name="password" label=msg("password")/> + +
+
+
+ <#if realm.resetPasswordAllowed> + ${msg("doForgotPassword")} + +
+
+
+ + <@buttons.loginButton /> +
+
+
+ + + 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 30c9d9a084..f1f6c8cfe5 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 @@ -1,7 +1,7 @@ <#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"> @@ -81,7 +81,8 @@ /* copy recovery codes */ function copyRecoveryCodes() { const tmpTextarea = document.createElement("textarea"); - document.body.appendChild(parseRecoveryCodeList()); + tmpTextarea.innerHTML = parseRecoveryCodeList(); + document.body.appendChild(tmpTextarea); tmpTextarea.select(); document.execCommand("copy"); document.body.removeChild(tmpTextarea); @@ -104,7 +105,7 @@ function parseRecoveryCodeList() { const recoveryCodes = document.getElementById("kc-recovery-codes-list").getElementsByTagName("li"); - const recoveryCodeList = ""; + let recoveryCodeList = ""; for (let i = 0; i < recoveryCodes.length; i++) { const recoveryCodeLiElement = recoveryCodes[i].innerText; diff --git a/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-input.ftl b/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-input.ftl new file mode 100644 index 0000000000..c59d5daab3 --- /dev/null +++ b/themes/src/main/resources/theme/keycloak.v2/login/login-recovery-authn-code-input.ftl @@ -0,0 +1,15 @@ +<#import "template.ftl" as layout> +<#import "field.ftl" as field> +<#import "buttons.ftl" as buttons> +<@layout.registrationLayout displayMessage=!messagesPerField.existsError('recoveryCodeInput'); section> + + <#if section = "header"> + ${msg("auth-recovery-code-header")} + <#elseif section = "form"> +
+ <@field.input name="recoveryCodeInput" label=msg("auth-recovery-code-prompt", recoveryAuthnCodesInputBean.codeNumber?c) /> + + <@buttons.loginButton /> +
+ + \ No newline at end of file diff --git a/themes/src/main/resources/theme/keycloak.v2/login/login-update-password.ftl b/themes/src/main/resources/theme/keycloak.v2/login/login-update-password.ftl index 4dc8cd1448..1e43ae2408 100755 --- a/themes/src/main/resources/theme/keycloak.v2/login/login-update-password.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/login-update-password.ftl @@ -75,6 +75,5 @@ - diff --git a/themes/src/main/resources/theme/keycloak.v2/login/login-username.ftl b/themes/src/main/resources/theme/keycloak.v2/login/login-username.ftl index 73202e8432..1325aa85f6 100755 --- a/themes/src/main/resources/theme/keycloak.v2/login/login-username.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/login-username.ftl @@ -2,6 +2,8 @@ <#import "field.ftl" as field> <#import "buttons.ftl" as buttons> <@layout.registrationLayout displayMessage=!messagesPerField.existsError('username') displayInfo=(realm.password && realm.registrationAllowed && !registrationDisabled??); section> + + <#if section = "header"> ${msg("loginAccountTitle")} <#elseif section = "form"> diff --git a/themes/src/main/resources/theme/keycloak.v2/login/login.ftl b/themes/src/main/resources/theme/keycloak.v2/login/login.ftl index 1731654475..a2333306a2 100755 --- a/themes/src/main/resources/theme/keycloak.v2/login/login.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/login.ftl @@ -2,6 +2,8 @@ <#import "field.ftl" as field> <#import "buttons.ftl" as buttons> <@layout.registrationLayout displayMessage=!messagesPerField.existsError('username','password') displayInfo=realm.password && realm.registrationAllowed && !registrationDisabled??; section> + + <#if section = "header"> ${msg("loginAccountTitle")} <#elseif section = "form"> @@ -30,7 +32,6 @@ - <#elseif section = "info" > <#if realm.password && realm.registrationAllowed && !registrationDisabled??>
diff --git a/themes/src/main/resources/theme/keycloak.v2/login/register.ftl b/themes/src/main/resources/theme/keycloak.v2/login/register.ftl index 5f243c445f..58156a4626 100755 --- a/themes/src/main/resources/theme/keycloak.v2/login/register.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/register.ftl @@ -3,6 +3,8 @@ <#import "user-profile-commons.ftl" as userProfileCommons> <#import "register-commons.ftl" as registerCommons> <@layout.registrationLayout displayMessage=messagesPerField.exists('global') displayRequiredFields=true; section> + + <#if section = "header"> <#if messageHeader??> ${kcSanitize(msg("${messageHeader}"))?no_esc} @@ -44,6 +46,5 @@
- 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 0a3d3d6bd6..f0fd9f629c 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 @@ -79,4 +79,9 @@ div.kc-logo-text span { white-space: normal; color: var(--pf-v5-global--Color--light-100) !important; text-align: center; +} + +hr { + margin-top: var(--pf-v5-global--spacer--sm); + margin-bottom: var(--pf-v5-global--spacer--md); } \ 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 index 4117018ddd..4a29fe9f37 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 @@ -1,5 +1,7 @@ <#import "template.ftl" as layout> <@layout.registrationLayout displayInfo=false; section> + + <#if section = "header" || section = "show-username"> <#if section = "header"> ${msg("loginChooseAuthenticator")} diff --git a/themes/src/main/resources/theme/keycloak.v2/login/template.ftl b/themes/src/main/resources/theme/keycloak.v2/login/template.ftl index 97b27ba7e2..818c890979 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/template.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/template.ftl @@ -41,6 +41,7 @@ +