0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

🐛 Fixed email verification mails not sent

no issue

- Email ownership verification emails for support/from address was not using the updated magic link service syntax
This commit is contained in:
Rish 2020-09-24 23:01:28 +05:30 committed by Rishabh Garg
parent 1dfaf8c5f8
commit 03968219a7
2 changed files with 10 additions and 6 deletions

View file

@ -97,7 +97,7 @@ module.exports = {
frame.response = async function (req, res) {
try {
const {token, action} = frame.options;
const updatedEmailAddress = membersService.settings.getEmailFromToken({token});
const updatedEmailAddress = await membersService.settings.getEmailFromToken({token});
const actionToKeyMapping = {
fromAddressUpdate: 'members_from_address',
supportAddressUpdate: 'members_support_address'

View file

@ -6,6 +6,9 @@ const settingsCache = require('../settings/cache');
const logging = require('../../../shared/logging');
const mail = require('../mail');
const updateEmailTemplate = require('./emails/updateEmail');
const SingleUseTokenProvider = require('./SingleUseTokenProvider');
const models = require('../../models');
const MAGIC_LINK_TOKEN_VALIDITY = 4 * 60 * 60 * 1000;
const ghostMailer = new mail.GhostMailer();
@ -63,14 +66,14 @@ function createSettingsInstance(config) {
const magicLinkService = new MagicLink({
transporter,
secret: config.getAuthSecret(),
tokenProvider: new SingleUseTokenProvider(models.SingleUseToken, MAGIC_LINK_TOKEN_VALIDITY),
getSigninURL,
getText,
getHTML,
getSubject
});
const sendEmailAddressUpdateMagicLink = ({email, payload = {}, type = 'fromAddressUpdate'}) => {
const sendEmailAddressUpdateMagicLink = ({email, type = 'fromAddressUpdate'}) => {
const [,toDomain] = email.split('@');
let fromEmail = `noreply@${toDomain}`;
if (fromEmail === email) {
@ -90,11 +93,12 @@ function createSettingsInstance(config) {
return ghostMailer.send(msg);
}
};
return magicLinkService.sendMagicLink({email, payload, subject: email, type});
return magicLinkService.sendMagicLink({email, tokenData: {email}, subject: email, type});
};
const getEmailFromToken = ({token}) => {
return magicLinkService.getUserFromToken(token);
const getEmailFromToken = async ({token}) => {
const data = await magicLinkService.getDataFromToken(token);
return data.email;
};
const getAdminRedirectLink = ({type}) => {