mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -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:
parent
d2634c7c7b
commit
b852de95c8
1 changed files with 6 additions and 4 deletions
|
@ -61,8 +61,8 @@ module.exports = function MembersApi({
|
||||||
getSigninURL
|
getSigninURL
|
||||||
});
|
});
|
||||||
|
|
||||||
async function sendEmailWithMagicLink(email){
|
async function sendEmailWithMagicLink(email, type){
|
||||||
return magicLinkService.sendMagicLink({email, user: {email}});
|
return magicLinkService.sendMagicLink({email, user: {email}, type});
|
||||||
}
|
}
|
||||||
|
|
||||||
const users = Users({
|
const users = Users({
|
||||||
|
@ -108,8 +108,9 @@ module.exports = function MembersApi({
|
||||||
res.writeHead(400);
|
res.writeHead(400);
|
||||||
return res.end('Bad Request.');
|
return res.end('Bad Request.');
|
||||||
}
|
}
|
||||||
|
const emailType = req.body.emailType;
|
||||||
try {
|
try {
|
||||||
await sendEmailWithMagicLink(email);
|
await sendEmailWithMagicLink(email, emailType);
|
||||||
res.writeHead(201);
|
res.writeHead(201);
|
||||||
return res.end('Created.');
|
return res.end('Created.');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -171,7 +172,8 @@ module.exports = function MembersApi({
|
||||||
|
|
||||||
await stripe.addCustomerToMember(member, customer);
|
await stripe.addCustomerToMember(member, customer);
|
||||||
|
|
||||||
await sendEmailWithMagicLink(customer.email);
|
const emailType = 'signup';
|
||||||
|
await sendEmailWithMagicLink(customer.email, emailType);
|
||||||
res.writeHead(200);
|
res.writeHead(200);
|
||||||
res.end();
|
res.end();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue