From 7e8938d749d4e2b01b16b7dfc4ced0da1ef23f2b Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Mon, 24 Apr 2023 11:21:26 +0200 Subject: [PATCH] [Fix] Don't count inactive accounts for registration blocking --- app/Http/Controllers/Auth/RegisterController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index b4e45934d..5fb8f290f 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -180,7 +180,8 @@ class RegisterController extends Controller } $limit = config('pixelfed.max_users'); if($limit) { - abort_if($limit <= User::count(), 404); + $count = User::where(function($q){ return $q->whereNull('status')->orWhereNotIn('status', ['deleted','delete']); })->count(); + abort_if($limit <= $count, 404); return view('auth.register'); } else { return view('auth.register'); @@ -204,7 +205,7 @@ class RegisterController extends Controller abort_if(BouncerService::checkIp($request->ip()), 404); } - $count = User::count(); + $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) {