diff options
author | vantezzen <properly@protonmail.com> | 2019-09-03 10:34:42 +0200 |
---|---|---|
committer | vantezzen <properly@protonmail.com> | 2019-09-03 10:34:42 +0200 |
commit | 6a9a42e50dfc9e7811e0b75da6b3ea456372d75e (patch) | |
tree | fdf4df53ba7484e709b144ae015213e4e0a180e6 /app/Controllers/Http/UserController.js | |
parent | Add legal documents to account import page (diff) | |
download | ferdium-server-6a9a42e50dfc9e7811e0b75da6b3ea456372d75e.tar.gz ferdium-server-6a9a42e50dfc9e7811e0b75da6b3ea456372d75e.tar.zst ferdium-server-6a9a42e50dfc9e7811e0b75da6b3ea456372d75e.zip |
Add CONNECT_WITH_FRANZ option
Diffstat (limited to 'app/Controllers/Http/UserController.js')
-rw-r--r-- | app/Controllers/Http/UserController.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/Controllers/Http/UserController.js b/app/Controllers/Http/UserController.js index 7c6cece..2a75f6e 100644 --- a/app/Controllers/Http/UserController.js +++ b/app/Controllers/Http/UserController.js | |||
@@ -6,6 +6,7 @@ const Workspace = use('App/Models/Workspace'); | |||
6 | const { | 6 | const { |
7 | validateAll | 7 | validateAll |
8 | } = use('Validator'); | 8 | } = use('Validator'); |
9 | const Env = use('Env') | ||
9 | 10 | ||
10 | const atob = require('atob'); | 11 | const atob = require('atob'); |
11 | const btoa = require('btoa'); | 12 | const btoa = require('btoa'); |
@@ -149,7 +150,7 @@ class UserController { | |||
149 | emailValidated: true, | 150 | emailValidated: true, |
150 | features: {}, | 151 | features: {}, |
151 | firstname: "Franz", | 152 | firstname: "Franz", |
152 | id: "2acd2aa0-0869-4a91-adab-f700ac256dbe", | 153 | id: "82c1cf9d-ab58-4da2-b55e-aaa41d2142d8", |
153 | isPremium: true, | 154 | isPremium: true, |
154 | isSubscriptionOwner: true, | 155 | isSubscriptionOwner: true, |
155 | lastname: "Franz", | 156 | lastname: "Franz", |
@@ -188,6 +189,16 @@ class UserController { | |||
188 | } = request.all() | 189 | } = request.all() |
189 | 190 | ||
190 | const hashedPassword = crypto.createHash('sha256').update(password).digest('base64'); | 191 | const hashedPassword = crypto.createHash('sha256').update(password).digest('base64'); |
192 | |||
193 | if(Env.get('CONNECT_WITH_FRANZ') == 'false') { | ||
194 | await User.create({ | ||
195 | email: userInf.email, | ||
196 | password: hashedPassword, | ||
197 | username: userInf.firstname | ||
198 | }); | ||
199 | |||
200 | return response.send('Your account has been created but due to this server\'s configuration, we could not import your Franz account data.\n\nIf you are the server owner, please set CONNECT_WITH_FRANZ to true to enable account imports.') | ||
201 | } | ||
191 | 202 | ||
192 | const base = 'https://api.franzinfra.com/v1/'; | 203 | const base = 'https://api.franzinfra.com/v1/'; |
193 | const userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Ferdi/5.3.0-beta.1 Chrome/69.0.3497.128 Electron/4.2.4 Safari/537.36'; | 204 | const userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Ferdi/5.3.0-beta.1 Chrome/69.0.3497.128 Electron/4.2.4 Safari/537.36'; |