]> Raphaël G. Git Repositories - userbundle/commitdiff
Add requirement
authorRaphaël Gertz <git@rapsys.eu>
Wed, 15 Sep 2021 15:32:55 +0000 (17:32 +0200)
committerRaphaël Gertz <git@rapsys.eu>
Wed, 15 Sep 2021 15:32:55 +0000 (17:32 +0200)
Form/LoginType.php

index 9c6fc59a1203038b035a86058e2698ff5566c354..d4413ede13ff0a2cbb70620f867958a3d6b7be50 100644 (file)
@@ -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]);
                        }
                }