Skip to content

Commit

Permalink
IBX-3972: Fixed reset and change password validation messages styling
Browse files Browse the repository at this point in the history
For more details see https://issues.ibexa.co/browse/IBX-3972 and #2094

* Added proper styling for frontend validation in reset/change password forms

* Removed duplicated errors from change password form

* Cleaned up redundant form blocks

---------

Co-authored-by: Michał Grabowski <[email protected]>
  • Loading branch information
alongosz and GrabowskiM authored Mar 1, 2023
1 parent 3be546d commit 4ba6fbb
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 42 deletions.
29 changes: 4 additions & 25 deletions src/bundle/Resources/public/scss/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,35 +67,14 @@ form:not(.form-inline) {
@include label-required();
}

&.is-invalid {
.ez-field__label-wrapper,
.ez-field__label {
color: $ibexa-color-danger;
}

.ez-field__data {
position: relative;

&:before {
content: '!';
position: absolute;
top: 0;
left: calculateRem(-20px);
width: calculateRem(20px);
background: $ibexa-color-primary;
color: $ibexa-white;
text-align: center;
font-size: calculateRem(16px);
border-top-left-radius: $ibexa-border-radius;
border-bottom-left-radius: $ibexa-border-radius;
}
.ez-data-source__input {
&.is-invalid {
@include input-invalid;
}
}

&__error {
display: inline-block;
margin-left: calculateRem(8px);
color: $ibexa-color-danger;
@include error-under-label();
}
}

Expand Down
16 changes: 13 additions & 3 deletions src/bundle/Resources/public/scss/_login.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
}

.ez-field__error {
margin-left: 0;
color: $ibexa-color-warning-dark;
@include error-under-label();
}

&__form-input {
&.is-invalid {
@include input-invalid;
}
}

&__image-col {
Expand Down Expand Up @@ -106,13 +111,18 @@

&__btn {
&--sign-in,
&--reset-password {
&--reset-password,
&--change-password {
padding: calculateRem(10px) calculateRem(80px);
}

&--cancel {
padding: calculateRem(10px) calculateRem(24px);
}

&--change-password {
margin-top: calculateRem(32px);
}
}

&__copright {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
{# @todo move to view/user/preferences in the future #}

{% use 'bootstrap_4_layout.html.twig' %}

{% trans_default_domain 'change_user_password' %}

{%- block form_errors -%}
{%- if errors|length > 0 -%}
{%- for error in errors -%}
<em class="ez-field__error">{{ error.message }}</em>
{%- endfor -%}
{%- endif -%}
{%- endblock -%}

{% block form_row -%}
{% set widget_wrapper_attr = widget_wrapper_attr|default({})|merge({'class': (widget_wrapper_attr.class|default('') ~ ' ez-field__data')|trim}) %}
{% set wrapper_class = 'ez-field form-group' %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{% extends '@ezdesign/ui/base.html.twig' %}

{% form_theme form_change_user_password '@ezdesign/account/change_password/form_fields.html.twig' %}
{% form_theme form_change_user_password with [
'@ezdesign/account/form_fields.html.twig',
'@ezdesign/account/change_password/form_fields.html.twig'
] %}

{% trans_default_domain 'user_change_password' %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@
{% set attr = attr|merge({'class': (attr.class|default('') ~ ' ez-login__form-input')|trim}) %}
{% set wrapper_attr = wrapper_attr|default({})|merge({'class': (wrapper_attr.class|default('') ~ ' ' ~ wrapper_class)|trim}) %}
<div{% with { attr: wrapper_attr } %}{{ block('attributes') }}{% endwith %}>
{{ block('form_errors') }}
{{ block('form_label') }}
<div class="ez-field__label-wrapper">
{{ block('form_label') }}
{{ block('form_errors') }}
</div>
{{- form_widget(form, {'attr': attr}) -}}
</div>
{%- endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<fieldset>
{{ form_widget(form_reset_user_password.new_password) }}
</fieldset>
{{ form_widget(form_reset_user_password.update, {'attr': {'class': 'btn btn-primary'}}) }}
{{ form_widget(form_reset_user_password.update, {'attr': {'class': 'btn btn-primary ez-login__btn--change-password'}}) }}
{{ form_end(form_reset_user_password) }}
{% endif %}

Expand Down

0 comments on commit 4ba6fbb

Please sign in to comment.