]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Form/Type/NewUserType.php
Symfony Upgrade Fixer FTW
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Form / Type / NewUserType.php
CommitLineData
e4977b8a 1<?php
4346a860 2
e4977b8a
J
3namespace Wallabag\CoreBundle\Form\Type;
4
5use Symfony\Component\Form\AbstractType;
619cc453
JB
6use Symfony\Component\Form\Extension\Core\Type\EmailType;
7use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
8use Symfony\Component\Form\Extension\Core\Type\SubmitType;
9use Symfony\Component\Form\Extension\Core\Type\TextType;
e4977b8a 10use Symfony\Component\Form\FormBuilderInterface;
75e9d1df 11use Symfony\Component\OptionsResolver\OptionsResolver;
e4977b8a
J
12use Symfony\Component\Validator\Constraints;
13
14class NewUserType extends AbstractType
15{
16 public function buildForm(FormBuilderInterface $builder, array $options)
17 {
18 $builder
619cc453
JB
19 ->add('username', TextType::class, array('required' => true))
20 ->add('plainPassword', RepeatedType::class, array(
fcb1fba5 21 'type' => 'password',
e4977b8a
J
22 'constraints' => array(
23 new Constraints\Length(array(
24 'min' => 8,
25 'minMessage' => 'Password should by at least 8 chars long',
26 )),
27 new Constraints\NotBlank(),
28 ),
29 ))
619cc453
JB
30 ->add('email', EmailType::class)
31 ->add('save', SubmitType::class)
e4977b8a
J
32 ;
33 }
34
75e9d1df 35 public function configureOptions(OptionsResolver $resolver)
e4977b8a
J
36 {
37 $resolver->setDefaults(array(
1210dae1 38 'data_class' => 'Wallabag\UserBundle\Entity\User',
e4977b8a
J
39 ));
40 }
41
619cc453 42 public function getBlockPrefix()
e4977b8a
J
43 {
44 return 'new_user';
45 }
46}