From 207bb36c89f1ac08f0e62159a01dbd1ee67a356a Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 16 Jan 2025 00:16:47 -0700 Subject: [PATCH] Increase username length limit from 15 to 30 --- app/Http/Controllers/AdminInviteController.php | 4 ++-- app/Http/Controllers/Api/ApiV1Dot1Controller.php | 2 +- app/Http/Controllers/Auth/RegisterController.php | 2 +- app/Http/Controllers/FederationController.php | 2 +- app/Http/Controllers/ProfileController.php | 2 +- app/Http/Controllers/RemoteAuthController.php | 4 ++-- app/Http/Controllers/SiteController.php | 2 +- app/Http/Controllers/UserEmailForgotController.php | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/AdminInviteController.php b/app/Http/Controllers/AdminInviteController.php index 144a2e34a..80db6e2e5 100644 --- a/app/Http/Controllers/AdminInviteController.php +++ b/app/Http/Controllers/AdminInviteController.php @@ -64,7 +64,7 @@ class AdminInviteController extends Controller $usernameRules = [ 'required', 'min:2', - 'max:15', + 'max:30', 'unique:users', function ($attribute, $value, $fail) { $dash = substr_count($value, '-'); @@ -152,7 +152,7 @@ class AdminInviteController extends Controller 'username' => [ 'required', 'min:2', - 'max:15', + 'max:30', 'unique:users', function ($attribute, $value, $fail) { $dash = substr_count($value, '-'); diff --git a/app/Http/Controllers/Api/ApiV1Dot1Controller.php b/app/Http/Controllers/Api/ApiV1Dot1Controller.php index 5bfbe8ad5..f9cac94be 100644 --- a/app/Http/Controllers/Api/ApiV1Dot1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Dot1Controller.php @@ -519,7 +519,7 @@ class ApiV1Dot1Controller extends Controller 'username' => [ 'required', 'min:2', - 'max:15', + 'max:30', 'unique:users', function ($attribute, $value, $fail) { $dash = substr_count($value, '-'); diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 230daea85..ad96a2ad7 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -69,7 +69,7 @@ class RegisterController extends Controller $usernameRules = [ 'required', 'min:2', - 'max:15', + 'max:30', 'unique:users', function ($attribute, $value, $fail) { $dash = substr_count($value, '-'); diff --git a/app/Http/Controllers/FederationController.php b/app/Http/Controllers/FederationController.php index 15570eb6b..a964cbeea 100644 --- a/app/Http/Controllers/FederationController.php +++ b/app/Http/Controllers/FederationController.php @@ -79,7 +79,7 @@ class FederationController extends Controller if (str_starts_with($resource, 'https://')) { if (str_starts_with($resource, 'https://'.$domain.'/users/')) { $username = str_replace('https://'.$domain.'/users/', '', $resource); - if (strlen($username) > 15) { + if (strlen($username) > 30) { return response('', 400); } $stripped = str_replace(['_', '.', '-'], '', $username); diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 5c6e4b082..effd21b70 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -344,7 +344,7 @@ class ProfileController extends Controller return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']); } - if (strlen($username) > 15 || strlen($username) < 2) { + if (strlen($username) > 30 || strlen($username) < 2) { return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']); } diff --git a/app/Http/Controllers/RemoteAuthController.php b/app/Http/Controllers/RemoteAuthController.php index e0afd82ef..73d4c5592 100644 --- a/app/Http/Controllers/RemoteAuthController.php +++ b/app/Http/Controllers/RemoteAuthController.php @@ -358,7 +358,7 @@ class RemoteAuthController extends Controller 'username' => [ 'required', 'min:2', - 'max:15', + 'max:30', function ($attribute, $value, $fail) { $dash = substr_count($value, '-'); $underscore = substr_count($value, '_'); @@ -489,7 +489,7 @@ class RemoteAuthController extends Controller 'username' => [ 'required', 'min:2', - 'max:15', + 'max:30', 'unique:users,username', function ($attribute, $value, $fail) { $dash = substr_count($value, '-'); diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php index 8c13e0b59..6837f7a94 100644 --- a/app/Http/Controllers/SiteController.php +++ b/app/Http/Controllers/SiteController.php @@ -119,7 +119,7 @@ class SiteController extends Controller public function followIntent(Request $request) { $this->validate($request, [ - 'user' => 'string|min:1|max:15|exists:users,username', + 'user' => 'string|min:1|max:30|exists:users,username', ]); $profile = Profile::whereUsername($request->input('user'))->firstOrFail(); $user = $request->user(); diff --git a/app/Http/Controllers/UserEmailForgotController.php b/app/Http/Controllers/UserEmailForgotController.php index 3889b9802..6792d3a11 100644 --- a/app/Http/Controllers/UserEmailForgotController.php +++ b/app/Http/Controllers/UserEmailForgotController.php @@ -27,7 +27,7 @@ class UserEmailForgotController extends Controller public function store(Request $request) { $rules = [ - 'username' => 'required|min:2|max:15|exists:users' + 'username' => 'required|min:2|max:30|exists:users' ]; $messages = [