diff options
Diffstat (limited to 'start/events.js')
-rw-r--r-- | start/events.js | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/start/events.js b/start/events.js deleted file mode 100644 index a99afd5..0000000 --- a/start/events.js +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | const Event = use('Event'); | ||
2 | const Mail = use('Mail'); | ||
3 | const Env = use('Env'); | ||
4 | |||
5 | Event.on('forgot::password', async ({ user, token }) => { | ||
6 | const body = ` | ||
7 | Hello ${user.username}, | ||
8 | we received a request to reset your Ferdium account password. | ||
9 | Use the link below to reset your password. If you didn't requested that your password be reset, please ignore this message. | ||
10 | |||
11 | ${Env.get('APP_URL')}/user/reset?token=${encodeURIComponent(token)} | ||
12 | |||
13 | This message was sent automatically. Please do not reply. | ||
14 | `; | ||
15 | console.log('Sending message', body); | ||
16 | try { | ||
17 | await Mail.raw(body, (message) => { | ||
18 | message.subject('[Ferdium] Reset your password'); | ||
19 | message.from(Env.get('MAIL_SENDER')); | ||
20 | message.to(user.email); | ||
21 | }); | ||
22 | } catch (e) { | ||
23 | console.log(`Couldn't send mail: ${e}`); | ||
24 | } | ||
25 | }); | ||