diff options
author | Bennett <hello@vantezzen.io> | 2020-03-10 15:11:03 +0100 |
---|---|---|
committer | Bennett <hello@vantezzen.io> | 2020-03-10 15:11:03 +0100 |
commit | bca1ffbd601a19245717752df9f312172aaa3bf8 (patch) | |
tree | 6c73a7554d651de1fcc3fb04c11868675c2d858d /app/Controllers/Http/UserController.js | |
parent | Merge branch 'master' of https://github.com/getferdi/server (diff) | |
download | ferdium-server-bca1ffbd601a19245717752df9f312172aaa3bf8.tar.gz ferdium-server-bca1ffbd601a19245717752df9f312172aaa3bf8.tar.zst ferdium-server-bca1ffbd601a19245717752df9f312172aaa3bf8.zip |
Add "IS_REGISTRATION_ENABLED" option
Diffstat (limited to 'app/Controllers/Http/UserController.js')
-rw-r--r-- | app/Controllers/Http/UserController.js | 14 |
1 files changed, 14 insertions, 0 deletions
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', |