Skip to content

Commit 20502c7

Browse files
authored
Merge pull request #2583 from symfonyaml/patch-2
Validates empty current password for ProfileFormType
2 parents a1b3867 + af8f0c2 commit 20502c7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Form/Type/ProfileFormType.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 ProfileFormType extends AbstractType
2122
{
@@ -51,7 +52,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
5152
'label' => 'form.current_password',
5253
'translation_domain' => 'FOSUserBundle',
5354
'mapped' => false,
54-
'constraints' => new UserPassword($constraintsOptions),
55+
'constraints' => array(
56+
new NotBlank(),
57+
new UserPassword($constraintsOptions),
58+
),
5559
));
5660
}
5761

0 commit comments

Comments
 (0)