3 namespace Wallabag\UserBundle\Form
;
5 use Symfony\Bridge\Doctrine\Form\Type\EntityType
;
6 use Symfony\Component\Form\AbstractType
;
7 use Symfony\Component\Form\Extension\Core\Type\EmailType
;
8 use Symfony\Component\Form\Extension\Core\Type\PasswordType
;
9 use Symfony\Component\Form\Extension\Core\Type\RepeatedType
;
10 use Symfony\Component\Form\Extension\Core\Type\SubmitType
;
11 use Symfony\Component\Form\Extension\Core\Type\TextType
;
12 use Symfony\Component\Form\FormBuilderInterface
;
13 use Symfony\Component\OptionsResolver\OptionsResolver
;
14 use Symfony\Component\Validator\Constraints
;
16 class NewUserType
extends AbstractType
18 public function buildForm(FormBuilderInterface
$builder, array $options)
21 ->add('username', TextType
::class, [
23 'label' => 'user.form.username_label',
25 ->add('plainPassword', RepeatedType
::class, [
26 'type' => PasswordType
::class,
27 'invalid_message' => 'validator.password_must_match',
28 'first_options' => ['label' => 'user.form.password_label'],
29 'second_options' => ['label' => 'user.form.repeat_new_password_label'],
31 new Constraints\
Length([
33 'minMessage' => 'validator.password_too_short',
35 new Constraints\
NotBlank(),
37 'label' => 'user.form.plain_password_label',
39 ->add('email', EmailType
::class, [
40 'label' => 'user.form.email_label',
42 ->add('groups', EntityType
::class, array(
43 'class' => 'WallabagGroupBundle:Group',
44 'choice_label' => 'name',
48 ->add('save', SubmitType
::class, [
49 'label' => 'user.form.save',
54 public function configureOptions(OptionsResolver
$resolver)
56 $resolver->setDefaults([
57 'data_class' => 'Wallabag\UserBundle\Entity\User',
61 public function getBlockPrefix()