Skip to content

Commit

Permalink
Add password change notification
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed May 8, 2024
1 parent 65b4898 commit 45e7f16
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/backend/src/routers/passwd.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ router.post('/passwd', auth, express.json(), async (req, res, next)=>{
[await bcrypt.hash(req.body.new_pass, 8), req.user.id]
);
invalidate_cached_user(req.user);

const svc_email = req.services.get('email');
svc_email.send_email({ email: user.email }, 'password_change_notification');

return res.send('Password successfully updated.')
}
}catch(e){
Expand Down
11 changes: 11 additions & 0 deletions packages/backend/src/services/EmailService.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ If this was not you, please contact [email protected] immediately.
</p>
`,
},
'password_change_notification': {
subject: '\u{1f511} Password change notification',
html: /*html*/`
<p>Hi there,</p>
<p>
We're sending an email to let you know about a change to your account.
Your password was recently changed. If this was not you, please contact
[email protected] immediately.
</p>
`,
},
'email_verification_code': {
subject: `{{code}} is your confirmation code`,
html: /*html*/`
Expand Down

0 comments on commit 45e7f16

Please sign in to comment.