2 namespace Wallabag\CoreBundle\Form\Type
;
4 use Symfony\Component\Form\AbstractType
;
5 use Symfony\Component\Form\FormBuilderInterface
;
6 use Symfony\Component\Security\Core\Validator\Constraints\UserPassword
;
7 use Symfony\Component\Validator\Constraints
;
9 class ChangePasswordType
extends AbstractType
11 public function buildForm(FormBuilderInterface
$builder, array $options)
14 ->add('old_password', 'password', array(
15 'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')),
17 ->add('new_password', 'repeated', array(
19 'invalid_message' => 'The password fields must match.',
21 'first_options' => array('label' => 'New password'),
22 'second_options' => array('label' => 'Repeat new password'),
23 'constraints' => array(
24 new Constraints\
Length(array(
26 'minMessage' => 'Password should by at least 8 chars long',
28 new Constraints\
NotBlank(),
31 ->add('save', 'submit')
35 public function getName()
37 return 'change_passwd';