]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php
Convert english translation 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(
0d42217e
JB
19 'constraints' => new UserPassword(array('message' => 'validator.password_wrong_value')),
20 'label' => 'config.form_password.old_password_label',
d9085c63 21 ))
619cc453 22 ->add('new_password', RepeatedType::class, array(
5c895a7f 23 'type' => PasswordType::class,
0d42217e 24 'invalid_message' => 'validator.password_must_match',
d9085c63 25 'required' => true,
0d42217e
JB
26 'first_options' => array('label' => 'config.form_password.new_password_label'),
27 'second_options' => array('label' => 'config.form_password.repeat_new_password_label'),
d9085c63
J
28 'constraints' => array(
29 new Constraints\Length(array(
c0d9eba0 30 'min' => 8,
0d42217e 31 'minMessage' => 'validator.password_too_short',
d9085c63 32 )),
c0d9eba0
J
33 new Constraints\NotBlank(),
34 ),
0d42217e
JB
35 'label' => 'config.form_password.new_password_label',
36 ))
37 ->add('save', SubmitType::class, array(
38 'label' => 'config.form.save',
d9085c63 39 ))
d9085c63
J
40 ;
41 }
42
619cc453 43 public function getBlockPrefix()
d9085c63
J
44 {
45 return 'change_passwd';
46 }
47}