Restrict new registrations with env setting

This commit is contained in:
Daniel Supernault 2018-05-23 21:03:20 -06:00
parent b6dc212b4d
commit 1e3a432087
3 changed files with 13 additions and 0 deletions

View file

@ -40,6 +40,8 @@ SESSION_SECURE_COOKIE=true
API_BASE="/api/1/" API_BASE="/api/1/"
API_SEARCH="/api/search" API_SEARCH="/api/search"
OPEN_REGISTRATION=true
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MIX_APP_URL="${APP_URL}" MIX_APP_URL="${APP_URL}"

View file

@ -39,6 +39,7 @@ class RegisterController extends Controller
public function __construct() public function __construct()
{ {
$this->middleware('guest'); $this->middleware('guest');
$this->openRegistrationCheck();
} }
/** /**
@ -83,4 +84,12 @@ class RegisterController extends Controller
return abort(403); return abort(403);
} }
} }
public function openRegistrationCheck()
{
$openRegistration = config('pixelfed.open_registration');
if(false == $openRegistration) {
abort(403);
}
}
} }

View file

@ -15,4 +15,6 @@ return [
'use_blacklist' => false 'use_blacklist' => false
], ],
'open_registration' => env('OPEN_REGISTRATION', true),
]; ];