From 4680e7a5cc1a0234256bb56333f09991fc862287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sun, 16 Jun 2024 17:21:55 +0200 Subject: [PATCH] i messed up authentication entirely, this commit restores it --- server/admin.api.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/admin.api.js b/server/admin.api.js index 16b1cd2a5..6880b7c68 100644 --- a/server/admin.api.js +++ b/server/admin.api.js @@ -21,7 +21,10 @@ const mw = { loginLimiter, (req, res, next) => { if (!req.get('authorization')) { - throw { HBErrorCode: '401', code: 401, message: 'Authorization Required' }; + return res + .set('WWW-Authenticate', 'Basic realm="Authorization Required"') + .status(401) + .send('Authorization Required'); } const [username, password] = Buffer.from(req.get('authorization').split(' ').pop(), 'base64') .toString('ascii')