Notify old email when email change is initiated

This commit is contained in:
KernelDeimos 2024-04-26 21:01:31 -04:00
parent fd59a6c994
commit 79d6f64451
2 changed files with 16 additions and 0 deletions

View File

@ -79,6 +79,11 @@ const CHANGE_EMAIL_START = eggspress('/change_email/start', {
confirm_url: `${config.origin}/change_email/confirm?token=${jwt_token}`, confirm_url: `${config.origin}/change_email/confirm?token=${jwt_token}`,
username: user.username, username: user.username,
}); });
const old_email = user.email;
// TODO: NotificationService
await svc_email.send_email({ email: old_email }, 'email_change_notification', {
new_email: new_email,
});
// update user // update user
await db.write( await db.write(

View File

@ -63,6 +63,17 @@ We received a request to link this email to the user "{{username}}" on Puter. If
<p> <p>
<a href="{{confirm_url}}">Confirm email change</a> <a href="{{confirm_url}}">Confirm email change</a>
</p>
`,
},
'email_change_notification': {
subject: '\u{1f4dd} Notification of email change',
html: `
<p>Hi there,</p>
<p>
We're sending an email to let you know about a change to your account.
We have sent a confirmation to "{{new_email}}" to confirm an email change request.
If this was not you, please contact support@puter.com immediately.
</p> </p>
`, `,
}, },