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/DashboardController.js | 1 - app/Controllers/Http/UserController.js | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'app/Controllers') diff --git a/app/Controllers/Http/DashboardController.js b/app/Controllers/Http/DashboardController.js index 1018f78..86cfa74 100644 --- a/app/Controllers/Http/DashboardController.js +++ b/app/Controllers/Http/DashboardController.js @@ -181,7 +181,6 @@ class DashboardController { session.flash({ type: 'danger', message: 'Invalid Ferdi account file' }); return response.redirect('back'); } - console.log(file); if (!file || !file.services || !file.workspaces) { session.flash({ type: 'danger', message: 'Invalid Ferdi account file (2)' }); 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-54-g00ecf