3 namespace Wallabag\CoreBundle\Form\Type
;
5 use Symfony\Component\Form\AbstractType
;
6 use Symfony\Component\Form\Extension\Core\Type\PasswordType
;
7 use Symfony\Component\Form\Extension\Core\Type\RepeatedType
;
8 use Symfony\Component\Form\Extension\Core\Type\SubmitType
;
9 use Symfony\Component\Form\FormBuilderInterface
;
10 use Symfony\Component\Security\Core\Validator\Constraints\UserPassword
;
11 use Symfony\Component\Validator\Constraints
;
13 class ChangePasswordType
extends AbstractType
15 public function buildForm(FormBuilderInterface
$builder, array $options)
18 ->add('old_password', PasswordType
::class, [
19 'constraints' => new UserPassword(['message' => 'validator.password_wrong_value']),
20 'label' => 'config.form_password.old_password_label',
22 ->add('new_password', RepeatedType
::class, [
23 'type' => PasswordType
::class,
24 'invalid_message' => 'validator.password_must_match',
26 'first_options' => ['label' => 'config.form_password.new_password_label'],
27 'second_options' => ['label' => 'config.form_password.repeat_new_password_label'],
29 new Constraints\
Length([
31 'minMessage' => 'validator.password_too_short',
33 new Constraints\
NotBlank(),
35 'label' => 'config.form_password.new_password_label',
37 ->add('save', SubmitType
::class, [
38 'label' => 'config.form.save',
43 public function getBlockPrefix()
45 return 'change_passwd';