3 namespace Wallabag\CoreBundle\Form\Type
;
5 use Symfony\Component\Form\AbstractType
;
6 use Symfony\Component\Form\Extension\Core\Type\PasswordType
;
7 use Symfony\Component\Form\Extension\Core\Type\RepeatedType
;
8 use Symfony\Component\Form\Extension\Core\Type\SubmitType
;
9 use Symfony\Component\Form\FormBuilderInterface
;
10 use Symfony\Component\Security\Core\Validator\Constraints\UserPassword
;
11 use Symfony\Component\Validator\Constraints
;
13 class ChangePasswordType
extends AbstractType
15 public function buildForm(FormBuilderInterface
$builder, array $options)
18 ->add('old_password', PasswordType
::class, array(
19 'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')),
21 ->add('new_password', RepeatedType
::class, array(
22 'type' => PasswordType
::class,
23 'invalid_message' => 'The password fields must match.',
25 'first_options' => array('label' => 'New password'),
26 'second_options' => array('label' => 'Repeat new password'),
27 'constraints' => array(
28 new Constraints\
Length(array(
30 'minMessage' => 'Password should by at least 8 chars long',
32 new Constraints\
NotBlank(),
35 ->add('save', SubmitType
::class)
39 public function getBlockPrefix()
41 return 'change_passwd';