From 77c0f7178e9ec29d9ef35497aaf566c04c9ca4ca Mon Sep 17 00:00:00 2001 From: teutat3s Date: Wed, 13 Nov 2024 17:06:04 +0100 Subject: [PATCH] fix: registration broken since update to 25.0.6 --- common/resources/css/index.css | 42 ++++-- common/resources/scss/form-group.scss | 9 +- common/resources/scss/page.scss | 5 + login/login-update-profile.ftl | 85 +----------- login/register.ftl | 189 ++++++++++++-------------- login/template.ftl | 2 + login/theme.properties | 3 + login/update-email.ftl | 21 +-- login/user-profile-commons.ftl | 74 ++++++---- 9 files changed, 189 insertions(+), 241 deletions(-) diff --git a/common/resources/css/index.css b/common/resources/css/index.css index fbbdc51..f4ff89b 100644 --- a/common/resources/css/index.css +++ b/common/resources/css/index.css @@ -21,8 +21,10 @@ html { width: 100vw; height: 100vh; margin: 0; - font-size: 20px; } - + font-size: 16px; } + @media screen and (min-width: 1200px) { + html { + font-size: 20px; } } *:focus-visible { outline: 0.2rem solid var(--accent); } @@ -57,23 +59,26 @@ html { padding: 0rem 2rem; } .ps-button { - padding: 0.5rem 1rem; font-size: 1rem; - line-height: 1.2rem; - border: 2px solid var(--foreground); - border-radius: 1.5rem; + padding: 0.5em 1em; + line-height: 1.2em; + border: 0.125em solid var(--foreground); + border-radius: 1.5em; background-color: var(--background-darker-2); cursor: pointer; } .ps-button:hover, .ps-button:focus { border-color: var(--accent); } .ps-button_primary { - border: 4px solid var(--foreground); + border: 0.25em solid var(--foreground); background-color: var(--background); color: var(--foreground); font-weight: bold; } .ps-button_primary:focus, .ps-button_primary:hover { background-color: var(--foreground); color: var(--background); } + .ps-button_small { + font-size: 0.8rem; + padding: 0.25em 0.7em; } .ps-input { padding: 0.5rem 0.5rem; @@ -116,18 +121,20 @@ html { display: flex; flex-direction: column; } .ps-form-group--label { - margin-bottom: 0.5rem; - display: flex; - font-weight: bold; } + margin-bottom: 0.25rem; + display: inline-block; + font-weight: bold; + margin-top: 0.5rem; } .ps-form-group .ps-button { align-self: flex-start; } .ps-form-group--error { margin-top: 0.25rem; color: var(--accent); font-weight: bold; } + .ps-form-group--buttons { + margin: 0.5rem 0; } .ps-homelink { - z-index: 100; pointer-events: all; color: var(--foreground); background: white; @@ -197,7 +204,9 @@ html { display: flex; justify-content: space-between; padding: 0; - margin: 0; } + margin: 0; + overflow-x: auto; + z-index: 100; } .ps-header--title { font-size: 1.5rem; padding: 0 1rem; @@ -206,8 +215,9 @@ html { background-color: var(--background); border-right: 0.5rem solid var(--foreground); pointer-events: all; } + .ps-header--i18n { + margin-left: auto; } .ps-header--nav { - margin-left: auto; display: flex; border-bottom: 0.5rem solid var(--foreground); border-left: 0.5rem solid var(--foreground); @@ -260,6 +270,9 @@ html { border-bottom: 0.5rem solid var(--foreground); padding-bottom: 0.5rem; margin: 2rem; } + .ps-page--subtitle { + padding-bottom: 0.25rem; + margin: 2rem; } .ps-page--section { border: 12px solid black; margin-top: 2rem; @@ -357,7 +370,8 @@ html { left: 0; width: 100%; background-color: var(--background); - border-bottom: 2px solid var(--foreground); } + border-bottom: 2px solid var(--foreground); + overflow-x: auto; } .ps-section-nav--list { list-style: none; display: flex; diff --git a/common/resources/scss/form-group.scss b/common/resources/scss/form-group.scss index 9aa6485..147e9ef 100644 --- a/common/resources/scss/form-group.scss +++ b/common/resources/scss/form-group.scss @@ -3,9 +3,10 @@ flex-direction: column; &--label { - margin-bottom: 0.5rem; - display: flex; + margin-bottom: 0.25rem; + display: inline-block; font-weight: bold; + margin-top: 0.5rem; } .ps-button { @@ -18,4 +19,8 @@ font-weight: bold; // font-family: monospace; } + + &--buttons { + margin: 0.5rem 0; + }; } diff --git a/common/resources/scss/page.scss b/common/resources/scss/page.scss index 31c9d3f..5818481 100644 --- a/common/resources/scss/page.scss +++ b/common/resources/scss/page.scss @@ -36,6 +36,11 @@ margin: 2rem; } + &--subtitle { + padding-bottom: 0.25rem; + margin: 2rem; + }; + &--section { border: 12px solid black; margin-top: 2rem; diff --git a/login/login-update-profile.ftl b/login/login-update-profile.ftl index be579b0..e09f5c3 100644 --- a/login/login-update-profile.ftl +++ b/login/login-update-profile.ftl @@ -1,83 +1,12 @@ <#import "template.ftl" as layout> -<@layout.registrationLayout displayMessage=!messagesPerField.existsError('username','email','firstName','lastName'); section> +<#import "user-profile-commons.ftl" as userProfileCommons> +<@layout.registrationLayout displayMessage=messagesPerField.exists('global') displayRequiredFields=true; section> <#if section = "header"> ${msg("loginProfileTitle")} <#elseif section = "form">
- <#if user.editUsernameAllowed> -
-
- -
-
- - <#if messagesPerField.existsError('username')> - - ${kcSanitize(messagesPerField.get('username'))?no_esc} - - -
-
- - <#if user.editEmailAllowed> -
-
- -
-
- - - <#if messagesPerField.existsError('email')> - - ${kcSanitize(messagesPerField.get('email'))?no_esc} - - -
-
- - -
-
- -
-
- - - <#if messagesPerField.existsError('firstName')> - - ${kcSanitize(messagesPerField.get('firstName'))?no_esc} - - -
-
- -
-
- -
-
- - - <#if messagesPerField.existsError('lastName')> - - ${kcSanitize(messagesPerField.get('lastName'))?no_esc} - - -
-
+ <@userProfileCommons.userProfileFormFields/>
@@ -87,13 +16,13 @@
<#if isAppInitiatedAction??> - - + + <#else> - +
- + \ No newline at end of file diff --git a/login/register.ftl b/login/register.ftl index 62e1eb1..7bbf5ed 100644 --- a/login/register.ftl +++ b/login/register.ftl @@ -1,112 +1,99 @@ <#import "template.ftl" as layout> -<@layout.registrationLayout displayMessage=!messagesPerField.existsError('firstName','lastName','email','username','password','password-confirm'); section> - <#if section = "header"> - ${msg("registerTitle")} - <#elseif section = "form"> -
- + <#if passwordRequired?? && (attribute.name == 'username' || (attribute.name == 'email' && realm.registrationEmailAsUsername))> +
+
+ * +
+
+
+ +
- <#if messagesPerField.existsError('lastName')> - - ${kcSanitize(messagesPerField.get('lastName'))?no_esc} - - - + <#if messagesPerField.existsError('password')> + + ${kcSanitize(messagesPerField.get('password'))?no_esc} + + +
+
- <#if !realm.registrationEmailAsUsername> -
- - +
+
+ * +
+
+
+ +
- <#if messagesPerField.existsError('username')> - - ${kcSanitize(messagesPerField.get('username'))?no_esc} - - -
- + <#if messagesPerField.existsError('password-confirm')> + + ${kcSanitize(messagesPerField.get('password-confirm'))?no_esc} + + +
+
+ + + -
- - + <@registerCommons.termsAcceptance/> - <#if messagesPerField.existsError('email')> - - ${kcSanitize(messagesPerField.get('email'))?no_esc} - - -
+ <#if recaptchaRequired?? && (recaptchaVisible!false)> +
+
+
+
+
+ - <#if passwordRequired??> -
- - +
- <#if messagesPerField.existsError('password')> - - ${kcSanitize(messagesPerField.get('password'))?no_esc} - - -
- -
- - - - <#if messagesPerField.existsError('password-confirm')> - - ${kcSanitize(messagesPerField.get('password-confirm'))?no_esc} - - -
- - - <#if recaptchaRequired??> -
-
-
- - -
- -
- - - + <#if recaptchaRequired?? && !(recaptchaVisible!false)> + +
+ +
+ <#else> +
+ +
+ + +
+ + diff --git a/login/template.ftl b/login/template.ftl index f8dd10b..81afc18 100644 --- a/login/template.ftl +++ b/login/template.ftl @@ -85,11 +85,13 @@ <#if !(auth?has_content && auth.showUsername() && !auth.showResetCredentials())>

<#nested "header">

+
<#if displayRequiredFields>
* ${msg("requiredFields")}
+
<#else> <#if displayRequiredFields>
diff --git a/login/theme.properties b/login/theme.properties index 04e01f7..ed75e9e 100644 --- a/login/theme.properties +++ b/login/theme.properties @@ -12,6 +12,9 @@ kcButtonLargeClass=ps-button_large kcFormGroupClass=ps-form-group kcLabelClass=ps-form-group--label kcInputErrorMessageClass=ps-form-group--error +kcFormOptionsClass=ps-form-group--options +kcFormOptionsWrapperClass=ps-form-group--options-wrapper +kcFormButtonsClass=ps-form-group--buttons kcInputClass=ps-input diff --git a/login/update-email.ftl b/login/update-email.ftl index e63b012..1650e25 100644 --- a/login/update-email.ftl +++ b/login/update-email.ftl @@ -1,27 +1,12 @@ <#import "template.ftl" as layout> <#import "password-commons.ftl" as passwordCommons> -<@layout.registrationLayout displayMessage=!messagesPerField.existsError('email'); section> +<#import "user-profile-commons.ftl" as userProfileCommons> +<@layout.registrationLayout displayMessage=messagesPerField.exists('global') displayRequiredFields=true; section> <#if section = "header"> ${msg("updateEmailTitle")} <#elseif section = "form">
-
-
- -
-
- - - <#if messagesPerField.existsError('email')> - - ${kcSanitize(messagesPerField.get('email'))?no_esc} - - -
-
+ <@userProfileCommons.userProfileFormFields/>
diff --git a/login/user-profile-commons.ftl b/login/user-profile-commons.ftl index 140eea3..8aa885d 100644 --- a/login/user-profile-commons.ftl +++ b/login/user-profile-commons.ftl @@ -3,27 +3,31 @@ <#list profile.attributes as attribute> - <#assign groupName = attribute.group!""> - <#if groupName != currentGroup> - <#assign currentGroup=groupName> - <#if currentGroup != "" > -
+ <#assign group = (attribute.group)!""> + <#if group != currentGroup> + <#assign currentGroup=group> + <#if currentGroup != ""> +
+ data-${key}="${value}" + + > - <#assign groupDisplayHeader=attribute.groupDisplayHeader!""> + <#assign groupDisplayHeader=group.displayHeader!""> <#if groupDisplayHeader != ""> - <#assign groupHeaderText=advancedMsg(attribute.groupDisplayHeader)!groupName> + <#assign groupHeaderText=advancedMsg(groupDisplayHeader)!group> <#else> - <#assign groupHeaderText=groupName> + <#assign groupHeaderText=group.name!"">
- +
- <#assign groupDisplayDescription=attribute.groupDisplayDescription!""> + <#assign groupDisplayDescription=group.displayDescription!""> <#if groupDisplayDescription != ""> - <#assign groupDescriptionText=advancedMsg(attribute.groupDisplayDescription)!""> + <#assign groupDescriptionText=advancedMsg(groupDisplayDescription)!"">
- +
@@ -53,6 +57,10 @@
<#nested "afterField" attribute> + + <#list profile.html5DataAnnotations?keys as key> + + <#macro inputFieldByType attribute> @@ -69,16 +77,22 @@ <@inputTagSelects attribute=attribute/> <#break> <#default> - <@inputTag attribute=attribute/> + <#if attribute.multivalued && attribute.values?has_content> + <#list attribute.values as value> + <@inputTag attribute=attribute value=value!''/> + + <#else> + <@inputTag attribute=attribute value=attribute.value!''/> + -<#macro inputTag attribute> - + disabled <#if attribute.autocomplete??>autocomplete="${attribute.autocomplete}" - <#if attribute.annotations.inputTypePlaceholder??>placeholder="${attribute.annotations.inputTypePlaceholder}" + <#if attribute.annotations.inputTypePlaceholder??>placeholder="${advancedMsg(attribute.annotations.inputTypePlaceholder)}" <#if attribute.annotations.inputTypePattern??>pattern="${attribute.annotations.inputTypePattern}" <#if attribute.annotations.inputTypeSize??>size="${attribute.annotations.inputTypeSize}" <#if attribute.annotations.inputTypeMaxlength??>maxlength="${attribute.annotations.inputTypeMaxlength}" @@ -86,6 +100,10 @@ <#if attribute.annotations.inputTypeMax??>max="${attribute.annotations.inputTypeMax}" <#if attribute.annotations.inputTypeMin??>min="${attribute.annotations.inputTypeMin}" <#if attribute.annotations.inputTypeStep??>step="${attribute.annotations.inputTypeStep}" + <#if attribute.annotations.inputTypeStep??>step="${attribute.annotations.inputTypeStep}" + <#list attribute.html5DataAnnotations as key, value> + data-${key}="${value}" + /> @@ -128,13 +146,14 @@ <#assign options=attribute.validators[attribute.annotations.inputOptionsFromValidation].options> <#elseif attribute.validators.options?? && attribute.validators.options.options??> <#assign options=attribute.validators.options.options> + <#else> + <#assign options=[]> - <#if options??> - <#list options as option> + <#list options as option> - - + + @@ -144,21 +163,22 @@ <#assign classDiv=properties.kcInputClassRadio!> <#assign classInput=properties.kcInputClassRadioInput!> <#assign classLabel=properties.kcInputClassRadioLabel!> - <#else> + <#else> <#assign inputType='checkbox'> <#assign classDiv=properties.kcInputClassCheckbox!> <#assign classInput=properties.kcInputClassCheckboxInput!> <#assign classLabel=properties.kcInputClassCheckboxLabel!> - + <#if attribute.annotations.inputOptionsFromValidation?? && attribute.validators[attribute.annotations.inputOptionsFromValidation]?? && attribute.validators[attribute.annotations.inputOptionsFromValidation].options??> <#assign options=attribute.validators[attribute.annotations.inputOptionsFromValidation].options> <#elseif attribute.validators.options?? && attribute.validators.options.options??> <#assign options=attribute.validators.options.options> + <#else> + <#assign options=[]> - <#if options??> - <#list options as option> + <#list options as option>
- - - + <#macro selectOptionLabelText attribute option> @@ -184,4 +202,4 @@ - \ No newline at end of file +