From b461f157ca52b05d42e1c105871b6f7823618f9b Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Fri, 26 Feb 2016 13:59:05 +1030 Subject: [PATCH] Use regex for username validation Laravel's alpha_dash rule allows unicode letters including those with inflections, leading to issues like #832. As per discussion in #557, we are sticking with ASCII-only usernames for now. --- framework/core/src/Core/Validator/UserValidator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/core/src/Core/Validator/UserValidator.php b/framework/core/src/Core/Validator/UserValidator.php index e37f78b87..3f4fad35f 100644 --- a/framework/core/src/Core/Validator/UserValidator.php +++ b/framework/core/src/Core/Validator/UserValidator.php @@ -45,7 +45,7 @@ class UserValidator extends AbstractValidator return [ 'username' => [ 'required', - 'alpha_dash', + 'regex:/^[a-z0-9_-]+$/i', 'unique:users,username'.$idSuffix, 'min:3', 'max:30'