3 namespace Rapsys\UserBundle\Form
;
5 use Symfony\Component\Form\AbstractType
;
6 use Symfony\Component\Form\FormBuilderInterface
;
7 use Symfony\Component\OptionsResolver\OptionsResolver
;
8 use Symfony\Component\Form\Extension\Core\Type\PasswordType
;
9 use Symfony\Component\Form\Extension\Core\Type\EmailType
;
10 use Symfony\Component\Form\Extension\Core\Type\SubmitType
;
11 use Symfony\Component\Validator\Constraints\Email
;
12 use Symfony\Component\Validator\Constraints\NotBlank
;
14 class LoginType
extends AbstractType
{
18 public function buildForm(FormBuilderInterface
$builder, array $options) {
20 ->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'])]])
21 ->add('password', PasswordType
::class, ['attr' => ['placeholder' => 'Your password'], 'constraints' => [new NotBlank(['message' => 'Please provide your password'])]])
22 ->add('submit', SubmitType
::class, ['label' => 'Send', 'attr' => ['class' => 'submit']]);
28 public function configureOptions(OptionsResolver
$resolver) {
29 $resolver->setDefaults(['error_bubbling' => true]);
35 public function getName() {
36 return 'rapsys_user_login';