Redirect on openid error

This commit is contained in:
Chocobozzz 2020-04-30 14:58:31 +02:00
parent abcface9b5
commit 3640cc3363
No known key found for this signature in database
GPG Key ID: 583A612D890159BE

View File

@ -192,13 +192,13 @@ async function handleCb (peertubeHelpers, settingsManager, req, res) {
if (!store.userAuthenticated) {
logger.info('Received callback but cannot userAuthenticated function does not exist.')
return res.sendStatus(400)
return onCBError(res)
}
const encryptedCodeVerifier = req.cookies[cookieName]
if (!encryptedCodeVerifier) {
logger.error('Received callback but code verifier not found in request cookie.')
return res.sendStatus(400)
return onCBError(res)
}
try {
@ -242,10 +242,14 @@ async function handleCb (peertubeHelpers, settingsManager, req, res) {
})
} catch (err) {
logger.error('Error in handle callback.', { err })
res.sendStatus(400)
onCBError(res)
}
}
function onCBError (res) {
res.redirect('/login?externalAuthError=true')
}
async function encrypt (data) {
const { algorithm, inputEncoding, outputEncoding } = encryptionOptions