From 0242eb9cda15d122d9bb7acae6f2df60396217ac Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Tue, 3 Sep 2024 20:12:33 +0200 Subject: [PATCH] styling for username form added class to form tag (#32511) fixes: #32510 Signed-off-by: Erik Jan de Wit --- .../theme/keycloak.v2/login/buttons.ftl | 16 +++++ .../keycloak.v2/login/login-username.ftl | 69 +++++++++++++++++++ .../theme/keycloak.v2/login/login.ftl | 7 +- .../theme/keycloak.v2/login/theme.properties | 2 + 4 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 themes/src/main/resources/theme/keycloak.v2/login/buttons.ftl create mode 100755 themes/src/main/resources/theme/keycloak.v2/login/login-username.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 new file mode 100644 index 0000000000..764bdc8f50 --- /dev/null +++ b/themes/src/main/resources/theme/keycloak.v2/login/buttons.ftl @@ -0,0 +1,16 @@ +<#macro actionGroup> +
+
+ <#nested> +
+ + +<#macro button id name label class="kcButtonPrimaryClass"> + + + +<#macro loginButton> + <@buttons.actionGroup> + <@buttons.button id="kc-login" name="login" label="doLogIn"/> + + \ No newline at end of file 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 new file mode 100755 index 0000000000..73202e8432 --- /dev/null +++ b/themes/src/main/resources/theme/keycloak.v2/login/login-username.ftl @@ -0,0 +1,69 @@ +<#import "template.ftl" as layout> +<#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"> +
+
+ <#if realm.password> +
+ <#if !usernameHidden??> +
+ <#assign label> + <#if !realm.loginWithEmailAllowed>${msg("username")}<#elseif !realm.registrationEmailAsUsername>${msg("usernameOrEmail")}<#else>${msg("email")} + + <@field.input name="username" label=label value="${(login.username!'')}" /> + + <#if messagesPerField.existsError('username')> + + ${kcSanitize(messagesPerField.get('username'))?no_esc} + + +
+ + +
+ <#if realm.rememberMe && !usernameHidden??> + <@field.checkbox name="rememberMe" label=msg("rememberMe") value=login.rememberMe?? /> + +
+ + <@buttons.loginButton /> +
+ +
+
+ + <#elseif section = "info" > + <#if realm.password && realm.registrationAllowed && !registrationDisabled??> +
+ ${msg("noAccount")} ${msg("doRegister")} +
+ + <#elseif section = "socialProviders" > + <#if realm.password && social?? && social.providers?has_content> +
+
+

${msg("identity-provider-login-label")}

+ + +
+ + + + 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 e6c105dc04..1731654475 100755 --- a/themes/src/main/resources/theme/keycloak.v2/login/login.ftl +++ b/themes/src/main/resources/theme/keycloak.v2/login/login.ftl @@ -1,5 +1,6 @@ <#import "template.ftl" as layout> <#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")} @@ -23,10 +24,8 @@
-
- value="${auth.selectedCredential}"/> - -
+ value="${auth.selectedCredential}"/> + <@buttons.loginButton /> 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 1f86e1ca9a..a1f4d3ff0f 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/theme.properties +++ b/themes/src/main/resources/theme/keycloak.v2/login/theme.properties @@ -34,6 +34,7 @@ kcAlertTitleClass=pf-v5-c-alert__title kcAlertDescriptionClass=pf-v5-c-alert__description kcFormPasswordVisibilityButtonClass=pf-v5-c-button pf-m-control kcFormControlToggleIcon=pf-v5-c-form-control__toggle-icon +kcFormActionGroupClass=pf-v5-c-form__actions kcPanelClass=pf-v5-c-panel pf-m-raised kcPanelMainClass=pf-v5-c-panel__main @@ -41,6 +42,7 @@ kcPanelMainBodyClass=pf-v5-c-panel__main-body kcListClass=pf-v5-c-list kcButtonClass=pf-v5-c-button +kcButtonPrimaryClass=pf-v5-c-button pf-m-primary pf-m-block 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