From ddd002094d5c80ca4065b7d181e7f5b9471556da Mon Sep 17 00:00:00 2001 From: vantezzen Date: Thu, 2 Apr 2020 15:32:18 +0200 Subject: Update dashboard design --- app/Controllers/Http/DashboardController.js | 17 ++++++++++++++--- app/Controllers/Http/UserController.js | 6 +++++- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/Http/DashboardController.js b/app/Controllers/Http/DashboardController.js index 86cfa74..a47beb6 100644 --- a/app/Controllers/Http/DashboardController.js +++ b/app/Controllers/Http/DashboardController.js @@ -134,6 +134,7 @@ class DashboardController { mail: general.email, created: general.created_at, updated: general.updated_at, + stringify: JSON.stringify, services, workspaces, }); @@ -165,6 +166,7 @@ class DashboardController { request, session, response, + view, }) { const validation = await validateAll(request.all(), { file: 'required', @@ -210,7 +212,10 @@ class DashboardController { } } catch (e) { const errorMessage = `Could not import your services into our system.\nError: ${e}`; - return response.status(401).send(errorMessage); + return view.render('others.message', { + heading: 'Error while importing', + text: errorMessage, + }); } // Import workspaces @@ -234,10 +239,16 @@ class DashboardController { } } catch (e) { const errorMessage = `Could not import your workspaces into our system.\nError: ${e}`; - return response.status(401).send(errorMessage); + return view.render('others.message', { + heading: 'Error while importing', + text: errorMessage, + }); } - return response.send('Your account has been imported.'); + return view.render('others.message', { + heading: 'Successfully imported', + text: 'Your account has been imported, you can now login as usual!', + }); } logout({ diff --git a/app/Controllers/Http/UserController.js b/app/Controllers/Http/UserController.js index e580e49..e367d99 100644 --- a/app/Controllers/Http/UserController.js +++ b/app/Controllers/Http/UserController.js @@ -203,6 +203,7 @@ class UserController { async import({ request, response, + view, }) { if (Env.get('IS_REGISTRATION_ENABLED') == 'false') { // eslint-disable-line eqeqeq return response.status(401).send({ @@ -227,7 +228,10 @@ class UserController { errorMessage += `${message.message}\n`; } } - return response.status(401).send(errorMessage); + return view.render('others.message', { + heading: 'Error while importing', + text: errorMessage, + }); } const { -- cgit v1.2.3-54-g00ecf