]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php
Update bundle & stock file
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Form / Type / ChangePasswordType.php
index 8bf4ca1ef6d100924e28069644c9057207a9246c..7d05a5d81442cb5f3ba04852f7c33b3fcd8b47fc 100644 (file)
@@ -1,9 +1,12 @@
 <?php
+
 namespace Wallabag\CoreBundle\Form\Type;
 
 use Symfony\Component\Form\AbstractType;
+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\FormBuilderInterface;
-use Symfony\Component\OptionsResolver\OptionsResolverInterface;
 use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
 use Symfony\Component\Validator\Constraints;
 
@@ -12,28 +15,28 @@ class ChangePasswordType extends AbstractType
     public function buildForm(FormBuilderInterface $builder, array $options)
     {
         $builder
-            ->add('old_password', 'password', array(
+            ->add('old_password', PasswordType::class, array(
                 'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')),
             ))
-            ->add('new_password', 'repeated', array(
-                'type' => 'password',
+            ->add('new_password', RepeatedType::class, array(
+                'type' => PasswordType::class,
                 'invalid_message' => 'The password fields must match.',
                 'required' => true,
-                'first_options'  => array('label' => 'New password'),
+                'first_options' => array('label' => 'New password'),
                 'second_options' => array('label' => 'Repeat new password'),
                 'constraints' => array(
                     new Constraints\Length(array(
-                        'min' => 6,
-                        'minMessage' => 'Password should by at least 6 chars long'
+                        'min' => 8,
+                        'minMessage' => 'Password should by at least 8 chars long',
                     )),
-                    new Constraints\NotBlank()
-                )
+                    new Constraints\NotBlank(),
+                ),
             ))
-            ->add('save', 'submit')
+            ->add('save', SubmitType::class)
         ;
     }
 
-    public function getName()
+    public function getBlockPrefix()
     {
         return 'change_passwd';
     }