mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:07:08 +00:00
@@ -166,6 +166,16 @@ async function auth(req, res, next) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If *all* else fails, check if the user came with a cookie
|
||||
// (see https://gitlab.com/wgp/dougal/software/-/issues/335)
|
||||
if (req.cookies.JWT) {
|
||||
const token = req.cookies.JWT;
|
||||
delete req.cookies.JWT;
|
||||
DEBUG("falling back to cookie-based authentication");
|
||||
req.user = await jwt.checkValidCredentials({jwt: token});
|
||||
return await auth(req, res, next);
|
||||
}
|
||||
|
||||
next({ status: 401, message: 'Not authorised' });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user