diff options
Diffstat (limited to 'app/Controllers/Http/Dashboard/ForgotPasswordController.ts')
-rw-r--r-- | app/Controllers/Http/Dashboard/ForgotPasswordController.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/app/Controllers/Http/Dashboard/ForgotPasswordController.ts b/app/Controllers/Http/Dashboard/ForgotPasswordController.ts index f7b1d0e..1878c4d 100644 --- a/app/Controllers/Http/Dashboard/ForgotPasswordController.ts +++ b/app/Controllers/Http/Dashboard/ForgotPasswordController.ts | |||
@@ -1,13 +1,13 @@ | |||
1 | import type { HttpContext } from '@adonisjs/core/http' | 1 | import type { HttpContext } from '@adonisjs/core/http'; |
2 | import { schema, rules, validator } from '@adonisjs/validator' | 2 | import { schema, rules, validator } from '@adonisjs/validator'; |
3 | import User from '#app/Models/User' | 3 | import User from '#app/Models/User'; |
4 | 4 | ||
5 | export default class ForgotPasswordController { | 5 | export default class ForgotPasswordController { |
6 | /** | 6 | /** |
7 | * Display the forgot password form | 7 | * Display the forgot password form |
8 | */ | 8 | */ |
9 | public async show({ view }: HttpContext) { | 9 | public async show({ view }: HttpContext) { |
10 | return view.render('dashboard/forgotPassword') | 10 | return view.render('dashboard/forgotPassword'); |
11 | } | 11 | } |
12 | 12 | ||
13 | /** | 13 | /** |
@@ -20,22 +20,22 @@ export default class ForgotPasswordController { | |||
20 | mail: schema.string([rules.email(), rules.required()]), | 20 | mail: schema.string([rules.email(), rules.required()]), |
21 | }), | 21 | }), |
22 | data: request.only(['mail']), | 22 | data: request.only(['mail']), |
23 | }) | 23 | }); |
24 | } catch { | 24 | } catch { |
25 | return view.render('others/message', { | 25 | return view.render('others/message', { |
26 | heading: 'Cannot reset your password', | 26 | heading: 'Cannot reset your password', |
27 | text: 'Please enter a valid email address', | 27 | text: 'Please enter a valid email address', |
28 | }) | 28 | }); |
29 | } | 29 | } |
30 | 30 | ||
31 | try { | 31 | try { |
32 | const user = await User.findByOrFail('email', request.input('mail')) | 32 | const user = await User.findByOrFail('email', request.input('mail')); |
33 | await user.forgotPassword() | 33 | await user.forgotPassword(); |
34 | } catch {} | 34 | } catch {} |
35 | 35 | ||
36 | return view.render('others/message', { | 36 | return view.render('others/message', { |
37 | heading: 'Reset password', | 37 | heading: 'Reset password', |
38 | text: 'If your provided E-Mail address is linked to an account, we have just sent an E-Mail to that address.', | 38 | text: 'If your provided E-Mail address is linked to an account, we have just sent an E-Mail to that address.', |
39 | }) | 39 | }); |
40 | } | 40 | } |
41 | } | 41 | } |