Skip to content

Commit 7084d48

Browse files
authored
Merge pull request #2582 from symfonyaml/patch-1
Validates empty current password for ChangePasswordFormType
2 parents 20502c7 + 4266f03 commit 7084d48

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Form/Type/ChangePasswordFormType.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\Form\FormBuilderInterface;
1717
use Symfony\Component\OptionsResolver\OptionsResolver;
1818
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
19+
use Symfony\Component\Validator\Constraints\NotBlank;
1920

2021
class ChangePasswordFormType extends AbstractType
2122
{
@@ -49,7 +50,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
4950
'label' => 'form.current_password',
5051
'translation_domain' => 'FOSUserBundle',
5152
'mapped' => false,
52-
'constraints' => new UserPassword($constraintsOptions),
53+
'constraints' => array(
54+
new NotBlank(),
55+
new UserPassword($constraintsOptions),
56+
),
5357
));
5458

5559
$builder->add('plainPassword', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\RepeatedType'), array(

0 commit comments

Comments
 (0)