aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLibravatar Bennett <hello@vantezzen.io>2020-03-10 15:11:03 +0100
committerLibravatar Bennett <hello@vantezzen.io>2020-03-10 15:11:03 +0100
commitbca1ffbd601a19245717752df9f312172aaa3bf8 (patch)
tree6c73a7554d651de1fcc3fb04c11868675c2d858d /app
parentMerge branch 'master' of https://github.com/getferdi/server (diff)
downloadferdium-server-bca1ffbd601a19245717752df9f312172aaa3bf8.tar.gz
ferdium-server-bca1ffbd601a19245717752df9f312172aaa3bf8.tar.zst
ferdium-server-bca1ffbd601a19245717752df9f312172aaa3bf8.zip
Add "IS_REGISTRATION_ENABLED" option
Diffstat (limited to 'app')
-rw-r--r--app/Controllers/Http/DashboardController.js1
-rw-r--r--app/Controllers/Http/UserController.js14
2 files changed, 14 insertions, 1 deletions
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 {
181 session.flash({ type: 'danger', message: 'Invalid Ferdi account file' }); 181 session.flash({ type: 'danger', message: 'Invalid Ferdi account file' });
182 return response.redirect('back'); 182 return response.redirect('back');
183 } 183 }
184 console.log(file);
185 184
186 if (!file || !file.services || !file.workspaces) { 185 if (!file || !file.services || !file.workspaces) {
187 session.flash({ type: 'danger', message: 'Invalid Ferdi account file (2)' }); 186 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 {
38 response, 38 response,
39 auth, 39 auth,
40 }) { 40 }) {
41 if (Env.get('IS_REGISTRATION_ENABLED') == 'false') { // eslint-disable-line eqeqeq
42 return response.status(401).send({
43 message: 'Registration is disabled on this server',
44 status: 401,
45 });
46 }
47
41 // Validate user input 48 // Validate user input
42 const validation = await validateAll(request.all(), { 49 const validation = await validateAll(request.all(), {
43 firstname: 'required', 50 firstname: 'required',
@@ -197,6 +204,13 @@ class UserController {
197 request, 204 request,
198 response, 205 response,
199 }) { 206 }) {
207 if (Env.get('IS_REGISTRATION_ENABLED') == 'false') { // eslint-disable-line eqeqeq
208 return response.status(401).send({
209 message: 'Registration is disabled on this server',
210 status: 401,
211 });
212 }
213
200 // Validate user input 214 // Validate user input
201 const validation = await validateAll(request.all(), { 215 const validation = await validateAll(request.all(), {
202 email: 'required|email|unique:users,email', 216 email: 'required|email|unique:users,email',