Add field to not register social account when called
This commit is contained in:
@@ -40,7 +40,7 @@ export async function socialEmailToLocal (user) {
|
||||
|
||||
export async function loginSocial (req, res) { // eslint-disable-line import/prefer-default-export
|
||||
let existingUser = res.locals.user;
|
||||
const { network } = req.body;
|
||||
const { network, allowRegister = true } = req.body;
|
||||
|
||||
const isSupportedNetwork = common.constants.SUPPORTED_SOCIAL_NETWORKS
|
||||
.find(supportedNetwork => supportedNetwork.key === network);
|
||||
@@ -74,6 +74,10 @@ export async function loginSocial (req, res) { // eslint-disable-line import/pre
|
||||
return loginRes(user, req, res);
|
||||
}
|
||||
|
||||
if (!allowRegister) {
|
||||
return res.respond(404, {});
|
||||
}
|
||||
|
||||
let email;
|
||||
if (profile.emails && profile.emails[0] && profile.emails[0].value) {
|
||||
email = profile.emails[0].value.toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user