diff options
author | vantezzen <properly@protonmail.com> | 2019-09-04 09:59:25 +0200 |
---|---|---|
committer | vantezzen <properly@protonmail.com> | 2019-09-04 09:59:25 +0200 |
commit | ea03e3766efffeb5e6b9bb90f566e64bf44640f3 (patch) | |
tree | 36f52de9554a08456949cc4a7fa5b40adc84ca94 /app/Controllers/Http/UserController.js | |
parent | Better response when recipe creation is disabled (diff) | |
download | ferdium-server-ea03e3766efffeb5e6b9bb90f566e64bf44640f3.tar.gz ferdium-server-ea03e3766efffeb5e6b9bb90f566e64bf44640f3.tar.zst ferdium-server-ea03e3766efffeb5e6b9bb90f566e64bf44640f3.zip |
Add user dashboard
Diffstat (limited to 'app/Controllers/Http/UserController.js')
-rw-r--r-- | app/Controllers/Http/UserController.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/Controllers/Http/UserController.js b/app/Controllers/Http/UserController.js index 2a75f6e..ced27bb 100644 --- a/app/Controllers/Http/UserController.js +++ b/app/Controllers/Http/UserController.js | |||
@@ -192,9 +192,9 @@ class UserController { | |||
192 | 192 | ||
193 | if(Env.get('CONNECT_WITH_FRANZ') == 'false') { | 193 | if(Env.get('CONNECT_WITH_FRANZ') == 'false') { |
194 | await User.create({ | 194 | await User.create({ |
195 | email: userInf.email, | 195 | email, |
196 | password: hashedPassword, | 196 | password: hashedPassword, |
197 | username: userInf.firstname | 197 | username: 'Franz' |
198 | }); | 198 | }); |
199 | 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.') | 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.') |
@@ -231,13 +231,18 @@ class UserController { | |||
231 | } | 231 | } |
232 | 232 | ||
233 | // Get user information | 233 | // Get user information |
234 | let userInf; | 234 | let userInf = false; |
235 | try { | 235 | try { |
236 | userInf = await franzRequest('me', 'GET', token) | 236 | userInf = await franzRequest('me', 'GET', token) |
237 | console.log('A', userInf) | ||
237 | } catch (e) { | 238 | } catch (e) { |
238 | const errorMessage = 'Could not get your user info from Franz. Please check your credentials or try again later.\nError: ' + e; | 239 | const errorMessage = 'Could not get your user info from Franz. Please check your credentials or try again later.\nError: ' + e; |
239 | return response.status(401).send(errorMessage) | 240 | return response.status(401).send(errorMessage) |
240 | } | 241 | } |
242 | if (!userInf) { | ||
243 | const errorMessage = 'Could not get your user info from Franz. Please check your credentials or try again later.\nError: ' + e; | ||
244 | return response.status(401).send(errorMessage) | ||
245 | } | ||
241 | 246 | ||
242 | // Create user in DB | 247 | // Create user in DB |
243 | let user; | 248 | let user; |