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