Merge pull request #5484 from pixelfed/staging

Increase username length limit from 15 to 30
This commit is contained in:
daniel 2025-01-16 00:18:25 -07:00 committed by GitHub
commit a1c13bbcbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 10 additions and 10 deletions

View file

@ -64,7 +64,7 @@ class AdminInviteController extends Controller
$usernameRules = [ $usernameRules = [
'required', 'required',
'min:2', 'min:2',
'max:15', 'max:30',
'unique:users', 'unique:users',
function ($attribute, $value, $fail) { function ($attribute, $value, $fail) {
$dash = substr_count($value, '-'); $dash = substr_count($value, '-');
@ -152,7 +152,7 @@ class AdminInviteController extends Controller
'username' => [ 'username' => [
'required', 'required',
'min:2', 'min:2',
'max:15', 'max:30',
'unique:users', 'unique:users',
function ($attribute, $value, $fail) { function ($attribute, $value, $fail) {
$dash = substr_count($value, '-'); $dash = substr_count($value, '-');

View file

@ -519,7 +519,7 @@ class ApiV1Dot1Controller extends Controller
'username' => [ 'username' => [
'required', 'required',
'min:2', 'min:2',
'max:15', 'max:30',
'unique:users', 'unique:users',
function ($attribute, $value, $fail) { function ($attribute, $value, $fail) {
$dash = substr_count($value, '-'); $dash = substr_count($value, '-');

View file

@ -69,7 +69,7 @@ class RegisterController extends Controller
$usernameRules = [ $usernameRules = [
'required', 'required',
'min:2', 'min:2',
'max:15', 'max:30',
'unique:users', 'unique:users',
function ($attribute, $value, $fail) { function ($attribute, $value, $fail) {
$dash = substr_count($value, '-'); $dash = substr_count($value, '-');

View file

@ -79,7 +79,7 @@ class FederationController extends Controller
if (str_starts_with($resource, 'https://')) { if (str_starts_with($resource, 'https://')) {
if (str_starts_with($resource, 'https://'.$domain.'/users/')) { if (str_starts_with($resource, 'https://'.$domain.'/users/')) {
$username = str_replace('https://'.$domain.'/users/', '', $resource); $username = str_replace('https://'.$domain.'/users/', '', $resource);
if (strlen($username) > 15) { if (strlen($username) > 30) {
return response('', 400); return response('', 400);
} }
$stripped = str_replace(['_', '.', '-'], '', $username); $stripped = str_replace(['_', '.', '-'], '', $username);

View file

@ -344,7 +344,7 @@ class ProfileController extends Controller
return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']); 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']); return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
} }

View file

@ -358,7 +358,7 @@ class RemoteAuthController extends Controller
'username' => [ 'username' => [
'required', 'required',
'min:2', 'min:2',
'max:15', 'max:30',
function ($attribute, $value, $fail) { function ($attribute, $value, $fail) {
$dash = substr_count($value, '-'); $dash = substr_count($value, '-');
$underscore = substr_count($value, '_'); $underscore = substr_count($value, '_');
@ -489,7 +489,7 @@ class RemoteAuthController extends Controller
'username' => [ 'username' => [
'required', 'required',
'min:2', 'min:2',
'max:15', 'max:30',
'unique:users,username', 'unique:users,username',
function ($attribute, $value, $fail) { function ($attribute, $value, $fail) {
$dash = substr_count($value, '-'); $dash = substr_count($value, '-');

View file

@ -119,7 +119,7 @@ class SiteController extends Controller
public function followIntent(Request $request) public function followIntent(Request $request)
{ {
$this->validate($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(); $profile = Profile::whereUsername($request->input('user'))->firstOrFail();
$user = $request->user(); $user = $request->user();

View file

@ -27,7 +27,7 @@ class UserEmailForgotController extends Controller
public function store(Request $request) public function store(Request $request)
{ {
$rules = [ $rules = [
'username' => 'required|min:2|max:15|exists:users' 'username' => 'required|min:2|max:30|exists:users'
]; ];
$messages = [ $messages = [