Skip to content

Commit

Permalink
fix: bug where confirmation email was sent to the old email address, …
Browse files Browse the repository at this point in the history
…not the new one
  • Loading branch information
julianlam committed Jul 30, 2021
1 parent 3bcd1f1 commit 414d733
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/emailer.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ Emailer.send = async (template, uid, params) => {
}

let userData = await User.getUserFields(uid, ['email', 'username', 'email:confirmed']);

// 'welcome' and 'verify-email' explicitly used passed-in email address
if (['welcome', 'verify-email'].includes(template)) {
userData.email = params.email;
}

({ template, userData, params } = await Plugins.hooks.fire('filter:email.prepare', { template, uid, userData, params }));
if (!userData || !userData.email) {
if (process.env.NODE_ENV === 'development') {
Expand Down

0 comments on commit 414d733

Please sign in to comment.