diff --git a/packages/backend/src/routers/change_email.js b/packages/backend/src/routers/change_email.js index fd1d9139..dea3d20c 100644 --- a/packages/backend/src/routers/change_email.js +++ b/packages/backend/src/routers/change_email.js @@ -79,6 +79,11 @@ const CHANGE_EMAIL_START = eggspress('/change_email/start', { confirm_url: `${config.origin}/change_email/confirm?token=${jwt_token}`, 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 await db.write( diff --git a/packages/backend/src/services/EmailService.js b/packages/backend/src/services/EmailService.js index 23f8d948..d125edc3 100644 --- a/packages/backend/src/services/EmailService.js +++ b/packages/backend/src/services/EmailService.js @@ -63,6 +63,17 @@ We received a request to link this email to the user "{{username}}" on Puter. If

Confirm email change +

+ `, + }, + 'email_change_notification': { + subject: '\u{1f4dd} Notification of email change', + html: ` +

Hi there,

+

+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.

`, },