]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Form/Type/NewUserType.php
Update bundle & stock file
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Form / Type / NewUserType.php
index b7ebe8c24d50fca2b58cab66cdf43ee1f9b4a8ef..ffbe9ba27b6a33209fc42aaeac05591d07ac16d0 100644 (file)
@@ -1,9 +1,15 @@
 <?php
+
 namespace Wallabag\CoreBundle\Form\Type;
 
 use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\Extension\Core\Type\EmailType;
+use Symfony\Component\Form\Extension\Core\Type\PasswordType;
+use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
+use Symfony\Component\Form\Extension\Core\Type\SubmitType;
+use Symfony\Component\Form\Extension\Core\Type\TextType;
 use Symfony\Component\Form\FormBuilderInterface;
-use Symfony\Component\OptionsResolver\OptionsResolverInterface;
+use Symfony\Component\OptionsResolver\OptionsResolver;
 use Symfony\Component\Validator\Constraints;
 
 class NewUserType extends AbstractType
@@ -11,8 +17,9 @@ class NewUserType extends AbstractType
     public function buildForm(FormBuilderInterface $builder, array $options)
     {
         $builder
-            ->add('username', 'text', array('required' => true))
-            ->add('password', 'password', array(
+            ->add('username', TextType::class, array('required' => true))
+            ->add('plainPassword', RepeatedType::class, array(
+                'type' => PasswordType::class,
                 'constraints' => array(
                     new Constraints\Length(array(
                         'min' => 8,
@@ -21,19 +28,19 @@ class NewUserType extends AbstractType
                     new Constraints\NotBlank(),
                 ),
             ))
-            ->add('email', 'email')
-            ->add('save', 'submit')
+            ->add('email', EmailType::class)
+            ->add('save', SubmitType::class)
         ;
     }
 
-    public function setDefaultOptions(OptionsResolverInterface $resolver)
+    public function configureOptions(OptionsResolver $resolver)
     {
         $resolver->setDefaults(array(
-            'data_class' => 'Wallabag\CoreBundle\Entity\User',
+            'data_class' => 'Wallabag\UserBundle\Entity\User',
         ));
     }
 
-    public function getName()
+    public function getBlockPrefix()
     {
         return 'new_user';
     }