Closed austinh closed 9 years ago
When using XML/YML you need to use full constraint class-name Rollerworks\Bundle\PasswordStrengthBundle\Validator\Constraints\BlackList
. and not the shorthand as that only works for build-in constraints.
Can you give the XML/YML your using for the validation?
Yes I am using the full constraint class-name. it still gives me the error above. I believe it is because Blacklist Constraint is calling 'rollerworks_password_strength.blacklist.validator' on line in the function validatedBy.
This is my YML.
Acme\UserBundle\Entity\User:
properties:
plainPassword:
- Length:
min: 6
minMessage: "Your password must have at least {{ limit }} characters."
max: 200
maxMessage: "Your password is too long."
groups: [Registration, Profile, ResetPassword, ChangePassword]
- NotBlank:
message: "Please enter a password"
groups: [Registration, Profile, ResetPassword, ChangePassword]
- Rollerworks\Bundle\PasswordStrengthBundle\Validator\Constraints\BlackList:
message: "Choose a better password. Password is insecure."
Try using the latest version.
Thank you so much for your quick reply! This fixed it! :D
Attempted to load class "rollerworks_password_strength.blacklist.validator" from the global namespace.
When using YAML to define a Constraint for a model field. I have checked, and everything is setup fine. In fact, when I switch to annotations to test it, it works.
However, I do not like using annotations. I prefer using yml. Especially of concern for overriding FOSUserBundle User constraints where it is impossible to use annotations and one must use a validation.xml file. I believe this is due to the validation.yml being loaded before PasswordStrengthBundle services config? Not sure though, as its very difficult to debug.
EDIT: I have checked to see if xml/yml format works with the other constraints and they do. Only the Blacklist validator does not work in xml/yml.