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