]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php
Update deps
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Form / Type / ChangePasswordType.php
CommitLineData
d9085c63
J
1<?php
2namespace Wallabag\CoreBundle\Form\Type;
3
4use Symfony\Component\Form\AbstractType;
5use Symfony\Component\Form\FormBuilderInterface;
d9085c63
J
6use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
7use Symfony\Component\Validator\Constraints;
8
9class ChangePasswordType extends AbstractType
10{
11 public function buildForm(FormBuilderInterface $builder, array $options)
12 {
13 $builder
14 ->add('old_password', 'password', array(
15 'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')),
16 ))
17 ->add('new_password', 'repeated', array(
18 'type' => 'password',
19 'invalid_message' => 'The password fields must match.',
20 'required' => true,
21 'first_options' => array('label' => 'New password'),
22 'second_options' => array('label' => 'Repeat new password'),
23 'constraints' => array(
24 new Constraints\Length(array(
c0d9eba0 25 'min' => 8,
e4977b8a 26 'minMessage' => 'Password should by at least 8 chars long',
d9085c63 27 )),
c0d9eba0
J
28 new Constraints\NotBlank(),
29 ),
d9085c63
J
30 ))
31 ->add('save', 'submit')
32 ;
33 }
34
35 public function getName()
36 {
37 return 'change_passwd';
38 }
39}