PasswordStrengthBundle
PasswordStrengthBundle copied to clipboard
Unable to have optional password validation
Hello there,
Bafford\PasswordStrengthBundle\Validator\Constraints\PasswordStrengthValidator
don't ignore empty values :
public function validate($value, Constraint $constraint)
{
if($value === null)
$value = '';
// ...
instead of
public function validate($value, Constraint $constraint)
{
if(null === $value || '' === $value) {
return;
}
// ...
Because of that it is not possible to have an optional password validation (in my case if the password is not present, then it will be autogenerated afterward).
Validation of emptyness should be left to the Symfony\Component\Validator\Constraints\NotBlank
constraint.
I am aware that this change will cause a BC break, but it will be great to see this implementation in a new release.