mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 18:32:41 +00:00
linting
This commit is contained in:
@@ -17,24 +17,24 @@ process.env.ADMIN_USER = process.env.ADMIN_USER || 'admin';
|
||||
process.env.ADMIN_PASS = process.env.ADMIN_PASS || 'password3';
|
||||
|
||||
const mw = {
|
||||
adminOnly: [
|
||||
loginLimiter,
|
||||
(req, res, next) => {
|
||||
if (!req.get('authorization')) {
|
||||
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')
|
||||
.split(':');
|
||||
if (process.env.ADMIN_USER === username && process.env.ADMIN_PASS === password) {
|
||||
return next();
|
||||
}
|
||||
throw { HBErrorCode: '53', code: 401, message: 'Access denied' };
|
||||
}
|
||||
]
|
||||
adminOnly : [
|
||||
loginLimiter,
|
||||
(req, res, next)=>{
|
||||
if(!req.get('authorization')) {
|
||||
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')
|
||||
.split(':');
|
||||
if(process.env.ADMIN_USER === username && process.env.ADMIN_PASS === password) {
|
||||
return next();
|
||||
}
|
||||
throw { HBErrorCode: '53', code: 401, message: 'Access denied' };
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const junkBrewPipeline = [
|
||||
|
||||
Reference in New Issue
Block a user