mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Added allowSelfSignup options to auth config
no-issue This flag is used to allow the sendMagicLink middleware to send an email to members which do not yet exist. When this flag is set to false, the only way to create members, would be via the stripe webook, or via the `create` method exposed on the `members` object
This commit is contained in:
parent
a643b3ff1f
commit
1208b41b9f
@ -14,6 +14,7 @@ module.exports = function MembersApi({
|
|||||||
publicKey
|
publicKey
|
||||||
},
|
},
|
||||||
auth: {
|
auth: {
|
||||||
|
allowSelfSignup,
|
||||||
getSigninURL
|
getSigninURL
|
||||||
},
|
},
|
||||||
paymentConfig,
|
paymentConfig,
|
||||||
@ -131,7 +132,14 @@ module.exports = function MembersApi({
|
|||||||
}
|
}
|
||||||
const emailType = req.body.emailType;
|
const emailType = req.body.emailType;
|
||||||
try {
|
try {
|
||||||
|
if (!allowSelfSignup) {
|
||||||
|
const member = await users.get({email});
|
||||||
|
if (member) {
|
||||||
await sendEmailWithMagicLink(email, emailType);
|
await sendEmailWithMagicLink(email, emailType);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await sendEmailWithMagicLink(email, emailType);
|
||||||
|
}
|
||||||
res.writeHead(201);
|
res.writeHead(201);
|
||||||
return res.end('Created.');
|
return res.end('Created.');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user