From 004fdcacb2356334dbdd52098283c58d42d3e491 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Thu, 8 Aug 2019 15:37:52 +0300 Subject: [PATCH] slight oversight --- server/routes/index.js | 51 ++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/server/routes/index.js b/server/routes/index.js index bff4b6a..b00df49 100644 --- a/server/routes/index.js +++ b/server/routes/index.js @@ -235,36 +235,39 @@ router.get('/user/manage', ensureLogin, wrap(async (req, res) => { totpEnabled = await API.User.Login.totpTokenRequired(req.session.user) } - // Decide whether we need a disconnect or a log in with button for social account logins - if (config.twitter && config.twitter.api) { - if (!socialStatus.enabled.twitter) { - res.locals.twitter_auth = true - } else if (socialStatus.source !== 'twitter') { - res.locals.twitter_auth = false + let et = config.external + if (et) { + // Decide whether we need a disconnect or a log in with button for social account logins + if (et.twitter && et.twitter.api) { + if (!socialStatus.enabled.twitter) { + res.locals.twitter = true + } else if (socialStatus.source !== 'twitter') { + res.locals.twitter = false + } } - } - if (config.discord && config.discord.api) { - if (!socialStatus.enabled.discord) { - res.locals.discord_auth = true - } else if (socialStatus.source !== 'discord') { - res.locals.discord_auth = false + if (et.discord && et.discord.api) { + if (!socialStatus.enabled.discord) { + res.locals.discord = true + } else if (socialStatus.source !== 'discord') { + res.locals.discord = false + } } - } - if (config.facebook && config.facebook.client) { - if (!socialStatus.enabled.facebook) { - res.locals.facebook_auth = config.facebook.client - } else if (socialStatus.source !== 'facebook') { - res.locals.facebook_auth = false + if (et.facebook && et.facebook.client) { + if (!socialStatus.enabled.facebook) { + res.locals.facebook = et.facebook.client + } else if (socialStatus.source !== 'facebook') { + res.locals.facebook = false + } } - } - if (config.google && config.google.api) { - if (!socialStatus.enabled.google) { - res.locals.google_auth = config.google.api - } else if (socialStatus.source !== 'google') { - res.locals.google_auth = false + if (et.google && et.google.api) { + if (!socialStatus.enabled.google) { + res.locals.google = et.google.api + } else if (socialStatus.source !== 'google') { + res.locals.google = false + } } }