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) {
|
frame.response = async function (req, res) {
|
||||||
try {
|
try {
|
||||||
const {token, action} = frame.options;
|
const {token, action} = frame.options;
|
||||||
const updatedEmailAddress = membersService.settings.getEmailFromToken({token});
|
const updatedEmailAddress = await membersService.settings.getEmailFromToken({token});
|
||||||
const actionToKeyMapping = {
|
const actionToKeyMapping = {
|
||||||
fromAddressUpdate: 'members_from_address',
|
fromAddressUpdate: 'members_from_address',
|
||||||
supportAddressUpdate: 'members_support_address'
|
supportAddressUpdate: 'members_support_address'
|
||||||
|
|
|
@ -6,6 +6,9 @@ const settingsCache = require('../settings/cache');
|
||||||
const logging = require('../../../shared/logging');
|
const logging = require('../../../shared/logging');
|
||||||
const mail = require('../mail');
|
const mail = require('../mail');
|
||||||
const updateEmailTemplate = require('./emails/updateEmail');
|
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();
|
const ghostMailer = new mail.GhostMailer();
|
||||||
|
|
||||||
|
@ -63,14 +66,14 @@ function createSettingsInstance(config) {
|
||||||
|
|
||||||
const magicLinkService = new MagicLink({
|
const magicLinkService = new MagicLink({
|
||||||
transporter,
|
transporter,
|
||||||
secret: config.getAuthSecret(),
|
tokenProvider: new SingleUseTokenProvider(models.SingleUseToken, MAGIC_LINK_TOKEN_VALIDITY),
|
||||||
getSigninURL,
|
getSigninURL,
|
||||||
getText,
|
getText,
|
||||||
getHTML,
|
getHTML,
|
||||||
getSubject
|
getSubject
|
||||||
});
|
});
|
||||||
|
|
||||||
const sendEmailAddressUpdateMagicLink = ({email, payload = {}, type = 'fromAddressUpdate'}) => {
|
const sendEmailAddressUpdateMagicLink = ({email, type = 'fromAddressUpdate'}) => {
|
||||||
const [,toDomain] = email.split('@');
|
const [,toDomain] = email.split('@');
|
||||||
let fromEmail = `noreply@${toDomain}`;
|
let fromEmail = `noreply@${toDomain}`;
|
||||||
if (fromEmail === email) {
|
if (fromEmail === email) {
|
||||||
|
@ -90,11 +93,12 @@ function createSettingsInstance(config) {
|
||||||
return ghostMailer.send(msg);
|
return ghostMailer.send(msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return magicLinkService.sendMagicLink({email, payload, subject: email, type});
|
return magicLinkService.sendMagicLink({email, tokenData: {email}, subject: email, type});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getEmailFromToken = ({token}) => {
|
const getEmailFromToken = async ({token}) => {
|
||||||
return magicLinkService.getUserFromToken(token);
|
const data = await magicLinkService.getDataFromToken(token);
|
||||||
|
return data.email;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAdminRedirectLink = ({type}) => {
|
const getAdminRedirectLink = ({type}) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue