diff options
author | 2021-07-05 19:47:47 +0530 | |
---|---|---|
committer | 2021-07-05 19:47:47 +0530 | |
commit | 96938cd6dd10e77e96d4ab34b6f64a349254d98d (patch) | |
tree | 68c9f814980e5cab5614d2c2816330a406749899 /app/Controllers/Http/DashboardController.js | |
parent | Change main license holder to Ferdi and remove one existing in docker directory (diff) | |
parent | Bump set-getter from 0.1.0 to 0.1.1 (diff) | |
download | ferdium-server-96938cd6dd10e77e96d4ab34b6f64a349254d98d.tar.gz ferdium-server-96938cd6dd10e77e96d4ab34b6f64a349254d98d.tar.zst ferdium-server-96938cd6dd10e77e96d4ab34b6f64a349254d98d.zip |
Merge branch 'master' into master
Diffstat (limited to 'app/Controllers/Http/DashboardController.js')
-rw-r--r-- | app/Controllers/Http/DashboardController.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/Controllers/Http/DashboardController.js b/app/Controllers/Http/DashboardController.js index 3de4816..a588c75 100644 --- a/app/Controllers/Http/DashboardController.js +++ b/app/Controllers/Http/DashboardController.js | |||
@@ -63,7 +63,8 @@ class DashboardController { | |||
63 | } | 63 | } |
64 | try { | 64 | try { |
65 | await Persona.forgotPassword(request.input('mail')); | 65 | await Persona.forgotPassword(request.input('mail')); |
66 | } catch(e) {} | 66 | // eslint-disable-next-line no-empty |
67 | } catch (e) {} | ||
67 | 68 | ||
68 | return view.render('others.message', { | 69 | return view.render('others.message', { |
69 | heading: 'Reset password', | 70 | heading: 'Reset password', |
@@ -91,11 +92,11 @@ class DashboardController { | |||
91 | const payload = { | 92 | const payload = { |
92 | password: crypto.createHash('sha256').update(request.input('password')).digest('base64'), | 93 | password: crypto.createHash('sha256').update(request.input('password')).digest('base64'), |
93 | password_confirmation: crypto.createHash('sha256').update(request.input('password_confirmation')).digest('base64'), | 94 | password_confirmation: crypto.createHash('sha256').update(request.input('password_confirmation')).digest('base64'), |
94 | } | 95 | }; |
95 | 96 | ||
96 | try { | 97 | try { |
97 | await Persona.updatePasswordByToken(request.input('token'), payload); | 98 | await Persona.updatePasswordByToken(request.input('token'), payload); |
98 | } catch(e) { | 99 | } catch (e) { |
99 | return view.render('others.message', { | 100 | return view.render('others.message', { |
100 | heading: 'Cannot reset your password', | 101 | heading: 'Cannot reset your password', |
101 | text: 'Please make sure you are using a valid and recent link to reset your password and that your passwords entered match.', | 102 | text: 'Please make sure you are using a valid and recent link to reset your password and that your passwords entered match.', |
@@ -122,6 +123,7 @@ class DashboardController { | |||
122 | return view.render('dashboard.account', { | 123 | return view.render('dashboard.account', { |
123 | username: auth.user.username, | 124 | username: auth.user.username, |
124 | email: auth.user.email, | 125 | email: auth.user.email, |
126 | lastname: auth.user.lastname, | ||
125 | }); | 127 | }); |
126 | } | 128 | } |
127 | 129 | ||
@@ -135,6 +137,7 @@ class DashboardController { | |||
135 | let validation = await validateAll(request.all(), { | 137 | let validation = await validateAll(request.all(), { |
136 | username: 'required', | 138 | username: 'required', |
137 | email: 'required', | 139 | email: 'required', |
140 | lastname: 'required', | ||
138 | }); | 141 | }); |
139 | if (validation.fails()) { | 142 | if (validation.fails()) { |
140 | session.withErrors(validation.messages()).flashExcept(['password']); | 143 | session.withErrors(validation.messages()).flashExcept(['password']); |
@@ -168,6 +171,7 @@ class DashboardController { | |||
168 | // Update user account | 171 | // Update user account |
169 | const { user } = auth; | 172 | const { user } = auth; |
170 | user.username = request.input('username'); | 173 | user.username = request.input('username'); |
174 | user.lastname = request.input('lastname'); | ||
171 | user.email = request.input('email'); | 175 | user.email = request.input('email'); |
172 | if (request.input('password')) { | 176 | if (request.input('password')) { |
173 | const hashedPassword = crypto.createHash('sha256').update(request.input('password')).digest('base64'); | 177 | const hashedPassword = crypto.createHash('sha256').update(request.input('password')).digest('base64'); |
@@ -192,6 +196,7 @@ class DashboardController { | |||
192 | 196 | ||
193 | return view.render('dashboard.data', { | 197 | return view.render('dashboard.data', { |
194 | username: general.username, | 198 | username: general.username, |
199 | lastname: general.lastname, | ||
195 | mail: general.email, | 200 | mail: general.email, |
196 | created: general.created_at, | 201 | created: general.created_at, |
197 | updated: general.updated_at, | 202 | updated: general.updated_at, |
@@ -211,6 +216,7 @@ class DashboardController { | |||
211 | 216 | ||
212 | const exportData = { | 217 | const exportData = { |
213 | username: general.username, | 218 | username: general.username, |
219 | lastname: general.lastname, | ||
214 | mail: general.email, | 220 | mail: general.email, |
215 | services, | 221 | services, |
216 | workspaces, | 222 | workspaces, |