From ea03e3766efffeb5e6b9bb90f566e64bf44640f3 Mon Sep 17 00:00:00 2001 From: vantezzen Date: Wed, 4 Sep 2019 09:59:25 +0200 Subject: Add user dashboard --- app/Controllers/Http/UserController.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'app/Controllers/Http/UserController.js') 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 { if(Env.get('CONNECT_WITH_FRANZ') == 'false') { await User.create({ - email: userInf.email, + email, password: hashedPassword, - username: userInf.firstname + username: 'Franz' }); 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 { } // Get user information - let userInf; + let userInf = false; try { userInf = await franzRequest('me', 'GET', token) + console.log('A', userInf) } catch (e) { const errorMessage = 'Could not get your user info from Franz. Please check your credentials or try again later.\nError: ' + e; return response.status(401).send(errorMessage) } + if (!userInf) { + const errorMessage = 'Could not get your user info from Franz. Please check your credentials or try again later.\nError: ' + e; + return response.status(401).send(errorMessage) + } // Create user in DB let user; -- cgit v1.2.3-70-g09d2