aboutsummaryrefslogtreecommitdiffstats
path: root/start/events.js
diff options
context:
space:
mode:
Diffstat (limited to 'start/events.js')
-rw-r--r--start/events.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/start/events.js b/start/events.js
new file mode 100644
index 0000000..0b7e28a
--- /dev/null
+++ b/start/events.js
@@ -0,0 +1,23 @@
1const Event = use('Event');
2const Mail = use('Mail');
3const Env = use('Env');
4
5Event.on('forgot::password', async ({ user, token }) => {
6 const body = `
7Hello ${user.username},
8we just recieved a request to reset your password of your Ferdi account.
9Use the link below to reset your password. If you havn't requested this, please ignore this message.
10
11${Env.get('APP_URL')}/user/reset?token=${encodeURIComponent(token)}
12
13This message was sent automatically. Please do not reply.
14`;
15console.log('Sending message', body);
16 try {
17 await Mail.raw(body, (message) => {
18 message.subject('[Ferdi] Reset your password')
19 message.from('noreply@getferdi.com')
20 message.to(user.email)
21 });
22 } catch(e) {}
23}); \ No newline at end of file