[UTIL][FORM] Password form now shows the proper HTML class, and it's respective label.

This commit is contained in:
Eliseu Amaro 2021-08-16 21:46:27 +01:00 committed by Hugo Sales
parent 87d7318de5
commit 44a581f0f6
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -17,17 +17,22 @@ abstract class FormFields
['type' => PasswordType::class, ['type' => PasswordType::class,
'first_options' => [ 'first_options' => [
'label' => _m('Password'), 'label' => _m('Password'),
'label_attr' => ['class' => 'section-form-label'],
'attr' => ['placeholder' => '********'], 'attr' => ['placeholder' => '********'],
'required' => $options['required'] ?? true, 'required' => $options['required'] ?? true,
'constraints' => [ 'constraints' => [
new NotBlank(['message' => _m('Please enter a password')]), 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')]), 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')]), ]), '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' => [ 'second_options' => [
'label' => _m('Repeat Password'), 'label' => _m('Repeat Password'),
'label_attr' => ['class' => 'section-form-label'],
'attr' => ['placeholder' => '********'], 'attr' => ['placeholder' => '********'],
'help' => _m('Confirm your password.'),
], ],
'mapped' => false, 'mapped' => false,
'invalid_message' => _m('The password fields must match'), 'invalid_message' => _m('The password fields must match'),
@ -42,6 +47,7 @@ abstract class FormFields
{ {
['password', PasswordType::class, [ ['password', PasswordType::class, [
'label' => _m('Password'), 'label' => _m('Password'),
'label_attr' => ['class' => 'section-form-label'],
'attr' => ['placeholder' => '********'], 'attr' => ['placeholder' => '********'],
'required' => $options['required'] ?? true, 'required' => $options['required'] ?? true,
'mapped' => false, 'mapped' => false,