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, [
22 'label' => 'config.form_new_user.username_label',
24 ->add('plainPassword', RepeatedType
::class, [
25 'type' => PasswordType
::class,
26 'invalid_message' => 'validator.password_must_match',
27 'first_options' => ['label' => 'config.form_new_user.password_label'],
28 'second_options' => ['label' => 'config.form_new_user.repeat_new_password_label'],
30 new Constraints\
Length([
32 'minMessage' => 'validator.password_too_short',
34 new Constraints\
NotBlank(),
36 'label' => 'config.form_new_user.plain_password_label',
38 ->add('email', EmailType
::class, [
39 'label' => 'config.form_new_user.email_label',
41 ->add('save', SubmitType
::class, [
42 'label' => 'config.form.save',
47 public function configureOptions(OptionsResolver
$resolver)
49 $resolver->setDefaults([
50 'data_class' => 'Wallabag\UserBundle\Entity\User',
54 public function getBlockPrefix()