From 918a7694417843bb8a3333d9f109fb1436fc33c1 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Wed, 9 Apr 2025 10:21:39 +0200 Subject: [PATCH] Add field to not register social account when called --- website/server/libs/auth/social.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/website/server/libs/auth/social.js b/website/server/libs/auth/social.js index e17b85b23d..bd5bf5f63c 100644 --- a/website/server/libs/auth/social.js +++ b/website/server/libs/auth/social.js @@ -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();