diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index ec7e15b7c..bc01b9489 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -58,7 +58,6 @@ class RegisterController extends Controller $data['email'] = strtolower($data['email']); } - $this->validateUsername($data['username']); $this->validateEmail($data['email']); $usernameRules = [ @@ -87,6 +86,11 @@ class RegisterController extends Controller if(!ctype_alnum($val)) { return $fail('Username is invalid. Username must be alpha-numeric and may contain dashes (-), periods (.) and underscores (_).'); } + + $restricted = RestrictedNames::get(); + if (in_array($value, $restricted)) { + return $fail('Username cannot be used.'); + } }, ]; @@ -123,15 +127,6 @@ class RegisterController extends Controller ]); } - public function validateUsername($username) - { - $restricted = RestrictedNames::get(); - - if (in_array($username, $restricted)) { - return abort(403); - } - } - public function validateEmail($email) { $banned = EmailService::isBanned($email);