]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php
Update bundle & stock file
[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;
619cc453
JB
6use Symfony\Component\Form\Extension\Core\Type\PasswordType;
7use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
8use Symfony\Component\Form\Extension\Core\Type\SubmitType;
d9085c63 9use Symfony\Component\Form\FormBuilderInterface;
d9085c63
J
10use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
11use Symfony\Component\Validator\Constraints;
12
13class ChangePasswordType extends AbstractType
14{
15 public function buildForm(FormBuilderInterface $builder, array $options)
16 {
17 $builder
619cc453 18 ->add('old_password', PasswordType::class, array(
d9085c63
J
19 'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')),
20 ))
619cc453 21 ->add('new_password', RepeatedType::class, array(
5c895a7f 22 'type' => PasswordType::class,
d9085c63
J
23 'invalid_message' => 'The password fields must match.',
24 'required' => true,
8ce32af6 25 'first_options' => array('label' => 'New password'),
d9085c63
J
26 'second_options' => array('label' => 'Repeat new password'),
27 'constraints' => array(
28 new Constraints\Length(array(
c0d9eba0 29 'min' => 8,
e4977b8a 30 'minMessage' => 'Password should by at least 8 chars long',
d9085c63 31 )),
c0d9eba0
J
32 new Constraints\NotBlank(),
33 ),
d9085c63 34 ))
619cc453 35 ->add('save', SubmitType::class)
d9085c63
J
36 ;
37 }
38
619cc453 39 public function getBlockPrefix()
d9085c63
J
40 {
41 return 'change_passwd';
42 }
43}