🐛 Fixed email update magic link not working

no issue

- Email update magic link was not sent out for sites which did not allow self signup as it didn't find the member on new email, which is expected.
- Updates sending magic link check in case an old email is found to correctly trigger update email
This commit is contained in:
Rish 2020-10-15 16:19:41 +05:30
parent 5129c0d9fc
commit d3bc625c35

View File

@ -216,10 +216,11 @@ module.exports = function MembersApi({
}
if (!allowSelfSignup) {
const member = await users.get({email});
const member = oldEmail ? await users.get({oldEmail}) : await users.get({email});
if (member) {
const tokenData = _.pick(req.body, ['oldEmail']);
await sendEmailWithMagicLink({email, tokenData, requestedType: emailType});
const forceEmailType = oldEmail ? true : false;
await sendEmailWithMagicLink({email, tokenData, requestedType: emailType, options: {forceEmailType}});
}
} else {
const tokenData = _.pick(req.body, ['labels', 'name', 'oldEmail']);