mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Add max user limit
This commit is contained in:
parent
261c33e7d8
commit
12995989c4
2 changed files with 20 additions and 2 deletions
|
@ -116,7 +116,13 @@ class RegisterController extends Controller
|
|||
*/
|
||||
public function showRegistrationForm()
|
||||
{
|
||||
$count = User::count();
|
||||
$limit = config('pixelfed.max_users');
|
||||
if($limit && $limit <= $count) {
|
||||
$view = 'site.closed-registration';
|
||||
} else {
|
||||
$view = config('pixelfed.open_registration') == true ? 'auth.register' : 'site.closed-registration';
|
||||
}
|
||||
return view($view);
|
||||
}
|
||||
|
||||
|
@ -128,7 +134,9 @@ class RegisterController extends Controller
|
|||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
if(false == config('pixelfed.open_registration')) {
|
||||
$count = User::count();
|
||||
$limit = config('pixelfed.max_users');
|
||||
if(false == config('pixelfed.open_registration') || $limit && $limit <= $count) {
|
||||
return abort(403);
|
||||
}
|
||||
|
||||
|
|
|
@ -208,6 +208,16 @@ return [
|
|||
*/
|
||||
'cloud_storage' => env('PF_ENABLE_CLOUD', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Max User Limit
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Allow a maximum number of user accounts. Default: off
|
||||
|
|
||||
*/
|
||||
'max_users' => env('PF_MAX_USERS', false),
|
||||
|
||||
|
||||
'media_types' => env('MEDIA_TYPES', 'image/jpeg,image/png,image/gif'),
|
||||
'enforce_account_limit' => env('LIMIT_ACCOUNT_SIZE', true),
|
||||
|
|
Loading…
Reference in a new issue