3 namespace Wallabag\CoreBundle\Form\Type
;
5 use Symfony\Component\Form\AbstractType
;
6 use Symfony\Component\Form\Extension\Core\Type\EmailType
;
7 use Symfony\Component\Form\Extension\Core\Type\PasswordType
;
8 use Symfony\Component\Form\Extension\Core\Type\RepeatedType
;
9 use Symfony\Component\Form\Extension\Core\Type\SubmitType
;
10 use Symfony\Component\Form\Extension\Core\Type\TextType
;
11 use Symfony\Component\Form\FormBuilderInterface
;
12 use Symfony\Component\OptionsResolver\OptionsResolver
;
13 use Symfony\Component\Validator\Constraints
;
15 class NewUserType
extends AbstractType
17 public function buildForm(FormBuilderInterface
$builder, array $options)
20 ->add('username', TextType
::class, array('required' => true))
21 ->add('plainPassword', RepeatedType
::class, array(
22 'type' => PasswordType
::class,
23 'invalid_message' => 'The password fields must match',
24 'first_options' => array('label' => 'Password'),
25 'second_options' => array('label' => 'Repeat new password'),
26 'constraints' => array(
27 new Constraints\
Length(array(
29 'minMessage' => 'Password should by at least 8 chars long',
31 new Constraints\
NotBlank(),
34 ->add('email', EmailType
::class)
35 ->add('save', SubmitType
::class)
39 public function configureOptions(OptionsResolver
$resolver)
41 $resolver->setDefaults(array(
42 'data_class' => 'Wallabag\UserBundle\Entity\User',
46 public function getBlockPrefix()