From bca1ffbd601a19245717752df9f312172aaa3bf8 Mon Sep 17 00:00:00 2001 From: Bennett Date: Tue, 10 Mar 2020 15:11:03 +0100 Subject: Add "IS_REGISTRATION_ENABLED" option --- app/Controllers/Http/UserController.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/Controllers/Http/UserController.js') diff --git a/app/Controllers/Http/UserController.js b/app/Controllers/Http/UserController.js index 979e78a..e580e49 100644 --- a/app/Controllers/Http/UserController.js +++ b/app/Controllers/Http/UserController.js @@ -38,6 +38,13 @@ class UserController { response, auth, }) { + if (Env.get('IS_REGISTRATION_ENABLED') == 'false') { // eslint-disable-line eqeqeq + return response.status(401).send({ + message: 'Registration is disabled on this server', + status: 401, + }); + } + // Validate user input const validation = await validateAll(request.all(), { firstname: 'required', @@ -197,6 +204,13 @@ class UserController { request, response, }) { + if (Env.get('IS_REGISTRATION_ENABLED') == 'false') { // eslint-disable-line eqeqeq + return response.status(401).send({ + message: 'Registration is disabled on this server', + status: 401, + }); + } + // Validate user input const validation = await validateAll(request.all(), { email: 'required|email|unique:users,email', -- cgit v1.2.3-70-g09d2