aboutsummaryrefslogtreecommitdiffstats
path: root/app/Models/User.ts
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/User.ts')
-rw-r--r--app/Models/User.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/Models/User.ts b/app/Models/User.ts
index 0ed4627..0b8e688 100644
--- a/app/Models/User.ts
+++ b/app/Models/User.ts
@@ -14,6 +14,9 @@ import randtoken from 'rand-token';
14import Token from './Token'; 14import Token from './Token';
15import Workspace from './Workspace'; 15import Workspace from './Workspace';
16import Service from './Service'; 16import Service from './Service';
17import Mail from '@ioc:Adonis/Addons/Mail';
18import { url } from 'Config/app';
19import { mailFrom } from 'Config/dashboard';
17 20
18export default class User extends BaseModel { 21export default class User extends BaseModel {
19 @column({ isPrimary: true }) 22 @column({ isPrimary: true })
@@ -66,6 +69,18 @@ export default class User extends BaseModel {
66 public async forgotPassword(): Promise<void> { 69 public async forgotPassword(): Promise<void> {
67 const token = await this.generateToken(this, 'forgot_password'); 70 const token = await this.generateToken(this, 'forgot_password');
68 71
72 await Mail.send(message => {
73 message
74 .from(mailFrom)
75 .to(this.email)
76 .subject('[Ferdium] Password Recovery')
77 .htmlView('emails/reset_password', {
78 username: this.username,
79 appUrl: url,
80 token: token,
81 });
82 });
83
69 await Event.emit('forgot:password', { 84 await Event.emit('forgot:password', {
70 user: this, 85 user: this,
71 token, 86 token,