0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

i messed up authentication entirely, this commit restores it

This commit is contained in:
Víctor Losada Hernández
2024-06-16 17:21:55 +02:00
parent f07252d670
commit 4680e7a5cc

View File

@@ -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')