partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit b5a1e5716c4341511617dad16a8fbe67972a79d9
parent 60e303850e6566a06ac6fa8e7d1f7b7d57fc2797
Author: Felicitus <felicitus@felicitus.org>
Date:   Sun,  3 May 2015 19:56:49 +0200

Escape dash (-) to have the regular expression work correctly

Diffstat:
Msrc/PartKeepr/AuthBundle/Validator/Constraints/UsernameValidator.php | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PartKeepr/AuthBundle/Validator/Constraints/UsernameValidator.php b/src/PartKeepr/AuthBundle/Validator/Constraints/UsernameValidator.php @@ -8,7 +8,7 @@ class UsernameValidator extends ConstraintValidator { public function validate($value, Constraint $constraint) { - if (!preg_match('/^[a-zA-Za0-9.-_\/\\\]{3,50}$/', $value, $matches)) { + if (!preg_match('/^[a-zA-Za0-9.\-_\/\\\]{3,50}$/', $value, $matches)) { // If you're using the new 2.5 validation API (you probably are!) $this->context->buildViolation($constraint->message) ->setParameter('%string%', $value)