From 7efd80b56c0c0106d16819ca9e4e88bf42f08a30 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Wed, 15 Sep 2021 17:32:55 +0200 Subject: [PATCH 1/1] Add requirement --- Form/LoginType.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Form/LoginType.php b/Form/LoginType.php index 9c6fc59..d4413ed 100644 --- a/Form/LoginType.php +++ b/Form/LoginType.php @@ -31,17 +31,17 @@ class LoginType extends AbstractType { //Add extra mail field if (!empty($options['mail'])) { - $form->add('mail', EmailType::class, ['attr' => ['placeholder' => 'Your mail'], 'constraints' => [new NotBlank(['message' => 'Please provide your mail']), new Email(['message' => 'Your mail doesn\'t seems to be valid'])]]); + $form->add('mail', EmailType::class, ['attr' => ['placeholder' => 'Your mail'], 'constraints' => [new NotBlank(['message' => 'Please provide your mail']), new Email(['message' => 'Your mail doesn\'t seems to be valid'])], 'required' => true]); } //Add extra password field if (!empty($options['password'])) { //Add password repeated field if (!empty($options['password_repeated'])) { - $form->add('password', RepeatedType::class, ['type' => PasswordType::class, 'invalid_message' => 'The password and confirmation must match', 'first_options' => ['attr' => ['placeholder' => 'Your password'], 'label' => 'Password'], 'second_options' => ['attr' => ['placeholder' => 'Your password confirmation'], 'label' => 'Confirm password'], 'options' => ['constraints' => [new NotBlank(['message' => 'Please provide your password'])]]]); + $form->add('password', RepeatedType::class, ['type' => PasswordType::class, 'invalid_message' => 'The password and confirmation must match', 'first_options' => ['attr' => ['placeholder' => 'Your password'], 'label' => 'Password'], 'second_options' => ['attr' => ['placeholder' => 'Your password confirmation'], 'label' => 'Confirm password'], 'options' => ['constraints' => [new NotBlank(['message' => 'Please provide your password'])]], 'required' => true]); //Add password field } else { - $form->add('password', PasswordType::class, ['attr' => ['placeholder' => 'Your password'], 'constraints' => [new NotBlank(['message' => 'Please provide your password'])]]); + $form->add('password', PasswordType::class, ['attr' => ['placeholder' => 'Your password'], 'constraints' => [new NotBlank(['message' => 'Please provide your password'])], 'required' => true]); } } -- 2.41.1