From 44a581f0f6fafe0b263574abcade4fd77f841bea Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Mon, 16 Aug 2021 21:46:27 +0100 Subject: [PATCH] [UTIL][FORM] Password form now shows the proper HTML class, and it's respective label. --- src/Util/Form/FormFields.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Util/Form/FormFields.php b/src/Util/Form/FormFields.php index 8271b8770f..764346b49d 100644 --- a/src/Util/Form/FormFields.php +++ b/src/Util/Form/FormFields.php @@ -16,18 +16,23 @@ abstract class FormFields return ['password', RepeatedType::class, ['type' => PasswordType::class, 'first_options' => [ - 'label' => _m('Password'), - 'attr' => ['placeholder' => '********'], - 'required' => $options['required'] ?? true, + 'label' => _m('Password'), + 'label_attr' => ['class' => 'section-form-label'], + 'attr' => ['placeholder' => '********'], + 'required' => $options['required'] ?? true, + 'constraints' => [ new NotBlank(['message' => _m('Please enter a password')]), new Length(['min' => Common::config('password', 'min_length'), 'minMessage' => _m(['Your password should be at least # characters'], ['count' => Common::config('password', 'min_length')]), 'max' => Common::config('password', 'max_length'), 'maxMessage' => _m(['Your password should be at most # characters'], ['count' => Common::config('password', 'max_length')]), ]), ], + 'help' => _m('Write a password with at least {min_length} characters, and a maximum of {max_length}.', ['min_length' => Common::config('password', 'min_length'), 'max_length' => Common::config('password', 'max_length')]), ], 'second_options' => [ - 'label' => _m('Repeat Password'), - 'attr' => ['placeholder' => '********'], + 'label' => _m('Repeat Password'), + 'label_attr' => ['class' => 'section-form-label'], + 'attr' => ['placeholder' => '********'], + 'help' => _m('Confirm your password.'), ], 'mapped' => false, 'invalid_message' => _m('The password fields must match'), @@ -42,6 +47,7 @@ abstract class FormFields { ['password', PasswordType::class, [ 'label' => _m('Password'), + 'label_attr' => ['class' => 'section-form-label'], 'attr' => ['placeholder' => '********'], 'required' => $options['required'] ?? true, 'mapped' => false,