0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

Updated members-api to pass the emailType to magic-link

no-issue

This will allow requests to send the correct email
This commit is contained in:
Fabien O'Carroll 2019-10-01 13:55:20 +07:00
parent d2634c7c7b
commit b852de95c8

View file

@ -61,8 +61,8 @@ module.exports = function MembersApi({
getSigninURL
});
async function sendEmailWithMagicLink(email){
return magicLinkService.sendMagicLink({email, user: {email}});
async function sendEmailWithMagicLink(email, type){
return magicLinkService.sendMagicLink({email, user: {email}, type});
}
const users = Users({
@ -108,8 +108,9 @@ module.exports = function MembersApi({
res.writeHead(400);
return res.end('Bad Request.');
}
const emailType = req.body.emailType;
try {
await sendEmailWithMagicLink(email);
await sendEmailWithMagicLink(email, emailType);
res.writeHead(201);
return res.end('Created.');
} catch (err) {
@ -171,7 +172,8 @@ module.exports = function MembersApi({
await stripe.addCustomerToMember(member, customer);
await sendEmailWithMagicLink(customer.email);
const emailType = 'signup';
await sendEmailWithMagicLink(customer.email, emailType);
res.writeHead(200);
res.end();
} catch (err) {