diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index b70f1d52a..5eb1159fe 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -178,8 +178,9 @@ class RegisterController extends Controller if(config('pixelfed.bouncer.cloud_ips.ban_signups')) { abort_if(BouncerService::checkIp(request()->ip()), 404); } - $limit = config('pixelfed.max_users'); - if($limit) { + $hasLimit = config('pixelfed.enforce_max_users'); + if($hasLimit) { + $limit = config('pixelfed.max_users'); $count = User::where(function($q){ return $q->whereNull('status')->orWhereNotIn('status', ['deleted','delete']); })->count(); if($limit <= $count) { return redirect(route('help.instance-max-users-limit')); @@ -208,13 +209,17 @@ class RegisterController extends Controller abort_if(BouncerService::checkIp($request->ip()), 404); } - $count = User::where(function($q){ return $q->whereNull('status')->orWhereNotIn('status', ['deleted','delete']); })->count(); - $limit = config('pixelfed.max_users'); + $hasLimit = config('pixelfed.enforce_max_users'); + if($hasLimit) { + $count = User::where(function($q){ return $q->whereNull('status')->orWhereNotIn('status', ['deleted','delete']); })->count(); + $limit = config('pixelfed.max_users'); - if(false == config_cache('pixelfed.open_registration') || $limit && $limit <= $count) { - return redirect(route('help.instance-max-users-limit')); + if($limit && $limit <= $count) { + return redirect(route('help.instance-max-users-limit')); + } } + $this->validator($request->all())->validate(); event(new Registered($user = $this->create($request->all()))); diff --git a/config/pixelfed.php b/config/pixelfed.php index 083c879c2..18e78b21d 100644 --- a/config/pixelfed.php +++ b/config/pixelfed.php @@ -198,7 +198,8 @@ return [ | Allow a maximum number of user accounts. Default: off | */ - 'max_users' => env('PF_MAX_USERS', false), + 'max_users' => env('PF_MAX_USERS', 1000), + 'enforce_max_users' => env('PF_ENFORCE_MAX_USERS', true), /* |--------------------------------------------------------------------------