slight oversight #3

This commit is contained in:
Evert Prants 2019-08-08 16:40:16 +03:00
parent a8a3ae3153
commit 29f6c56161
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -99,7 +99,7 @@ function removeAuthMiddleware (identifier) {
* No tokens saved in configs, everything works out-of-the-box
*/
router.post('/external/facebook/callback', wrap(async (req, res, next) => {
if (!config.facebook || !config.facebook.client) return next()
if (!config.external || !config.external.facebook || !config.external.facebook.client) return next()
// Fix up the retarded object Facebook sends us
let sane = objectAssembler(req.body)
@ -133,7 +133,7 @@ router.get('/external/facebook/remove', removeAuthMiddleware('facebook'))
* Tokens in configs
*/
router.get('/external/twitter/login', wrap(async (req, res) => {
if (!config.twitter || !config.twitter.api) return res.redirect('/')
if (!config.external || !config.external.twitter || !config.external.twitter.api) return res.redirect('/')
let tokens = await APIExtern.Twitter.getRequestToken()
if (tokens.error) {
@ -146,7 +146,7 @@ router.get('/external/twitter/login', wrap(async (req, res) => {
}))
router.get('/external/twitter/callback', wrap(async (req, res) => {
if (!config.twitter || !config.twitter.api) return res.redirect('/login')
if (!config.external || !config.external.twitter || !config.external.twitter.api) return res.redirect('/login')
if (!req.session.twitter_auth) return res.redirect('/login')
let ta = req.session.twitter_auth
let uri = '/login'
@ -189,7 +189,7 @@ router.get('/external/twitter/remove', removeAuthMiddleware('twitter'))
* Tokens in configs
*/
router.get('/external/discord/login', wrap(async (req, res) => {
if (!config.discord || !config.discord.api) return res.redirect('/')
if (!config.external || !config.external.discord || !config.external.discord.api) return res.redirect('/')
let infos = APIExtern.Discord.getAuthorizeURL(req)
@ -197,7 +197,7 @@ router.get('/external/discord/login', wrap(async (req, res) => {
}))
router.get('/external/discord/callback', wrap(async (req, res) => {
if (!config.discord || !config.discord.api) return res.redirect('/login')
if (!config.external || !config.external.discord || !config.external.discord.api) return res.redirect('/login')
let code = req.query.code
let state = req.query.state
@ -246,13 +246,13 @@ router.get('/external/discord/remove', removeAuthMiddleware('discord'))
* Tokens in configs
*/
router.get('/external/google/login', wrap(async (req, res) => {
if (!config.google || !config.google.api) return res.redirect('/')
if (!config.external || !config.external.google || !config.external.google.api) return res.redirect('/')
res.redirect('/login')
}))
router.post('/external/google/callback', wrap(async (req, res) => {
if (!config.google || !config.google.api) return res.redirect('/login')
if (!config.external || !config.external.google || !config.external.google.api) return res.redirect('/login')
if (!req.body.id_token) {
return JsonData(req, res, 'Invalid or missing ID token!', '/login')