Verified Commit 3640cc33 authored by Chocobozzz's avatar Chocobozzz
Browse files

Redirect on openid error

parent abcface9
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment