diff options
-rw-r--r-- | .env.example | 1 | ||||
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | app/Controllers/Http/DashboardController.js | 1 | ||||
-rw-r--r-- | app/Controllers/Http/UserController.js | 14 |
5 files changed, 20 insertions, 3 deletions
diff --git a/.env.example b/.env.example index c175cd1..f4e828b 100644 --- a/.env.example +++ b/.env.example | |||
@@ -19,4 +19,5 @@ DB_DATABASE=adonis | |||
19 | HASH_DRIVER=bcrypt | 19 | HASH_DRIVER=bcrypt |
20 | 20 | ||
21 | IS_CREATION_ENABLED=true | 21 | IS_CREATION_ENABLED=true |
22 | IS_REGISTRATION_ENABLED=true | ||
22 | CONNECT_WITH_FRANZ=true \ No newline at end of file | 23 | CONNECT_WITH_FRANZ=true \ No newline at end of file |
@@ -19,4 +19,5 @@ public/terms.html | |||
19 | public/privacy.html | 19 | public/privacy.html |
20 | 20 | ||
21 | resources/announcements/*.json | 21 | resources/announcements/*.json |
22 | !resources/announcements/version.json \ No newline at end of file | 22 | !resources/announcements/version.json |
23 | npm-debug.log | ||
@@ -76,7 +76,8 @@ After setting up the docker container we recommend you to set up an NGINX revers | |||
76 | - DB_PASSWORD=<yourdbpass> | 76 | - DB_PASSWORD=<yourdbpass> |
77 | - DB_DATABASE=<yourdbdatabase> | 77 | - DB_DATABASE=<yourdbdatabase> |
78 | - IS_CREATION_ENABLED=true/false | 78 | - IS_CREATION_ENABLED=true/false |
79 | - CONNECT_WITH_FRANZ=true/flase | 79 | - CONNECT_WITH_FRANZ=true/false |
80 | - IS_REGISTRATION_ENABLED=true/false | ||
80 | volumes: | 81 | volumes: |
81 | - <path to data>:/config | 82 | - <path to data>:/config |
82 | - <path to database>:/usr/src/app/database | 83 | - <path to database>:/usr/src/app/database |
@@ -106,6 +107,7 @@ For more information on configuring the Docker image, visit the Docker image rep | |||
106 | ## Configuration | 107 | ## Configuration |
107 | franz-server's configuration is saved inside the `.env` file. Besides AdonisJS's settings, ferdi-server has the following custom settings: | 108 | franz-server's configuration is saved inside the `.env` file. Besides AdonisJS's settings, ferdi-server has the following custom settings: |
108 | - `IS_CREATION_ENABLED` (`true` or `false`, default: `true`): Whether to enable the [creation of custom recipes](#creating-and-using-custom-recipes) | 109 | - `IS_CREATION_ENABLED` (`true` or `false`, default: `true`): Whether to enable the [creation of custom recipes](#creating-and-using-custom-recipes) |
110 | - `IS_REGISTRATION_ENABLED` (`true` or `false`, default: `true`): Whether to enable the creation of new user accounts | ||
109 | - `CONNECT_WITH_FRANZ` (`true` or `false`, default: `true`): Whether to enable connections to the Franz server. By enabling this option, ferdi-server can: | 111 | - `CONNECT_WITH_FRANZ` (`true` or `false`, default: `true`): Whether to enable connections to the Franz server. By enabling this option, ferdi-server can: |
110 | - Show the full Franz recipe library instead of only custom recipes | 112 | - Show the full Franz recipe library instead of only custom recipes |
111 | - Import Franz accounts | 113 | - Import Franz accounts |
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', |