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:
parent
1dfaf8c5f8
commit
03968219a7
2 changed files with 10 additions and 6 deletions
|
@ -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'
|
||||
|
|
|
@ -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}) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue