Add field to not register social account when called

This commit is contained in:
Phillip Thelen
2025-04-09 10:21:39 +02:00
parent 1fab19acf4
commit 918a769441
+5 -1
View File
@@ -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();