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.
This commit is contained in:
Toby Zerner 2016-02-26 13:59:05 +10:30
parent bc95ab8ae1
commit b461f157ca

View File

@ -45,7 +45,7 @@ class UserValidator extends AbstractValidator
return [ return [
'username' => [ 'username' => [
'required', 'required',
'alpha_dash', 'regex:/^[a-z0-9_-]+$/i',
'unique:users,username'.$idSuffix, 'unique:users,username'.$idSuffix,
'min:3', 'min:3',
'max:30' 'max:30'