webaccess: Add semicolons after statements

pull/4250/head
Richard Hansen 2020-08-25 16:44:44 -04:00 committed by John McLear
parent e82a3055e6
commit 9011207a37
1 changed files with 14 additions and 14 deletions

View File

@ -13,8 +13,8 @@ exports.basicAuth = function(req, res, next) {
var hookResultMangle = function(cb) { var hookResultMangle = function(cb) {
return function(err, data) { return function(err, data) {
return cb(!err && data.length && data[0]); return cb(!err && data.length && data[0]);
} };
} };
var authorize = function(cb) { var authorize = function(cb) {
// Do not require auth for static paths and the API...this could be a bit brittle // Do not require auth for static paths and the API...this could be a bit brittle
@ -28,12 +28,12 @@ exports.basicAuth = function(req, res, next) {
if (req.session && req.session.user && req.session.user.is_admin) return cb(true); if (req.session && req.session.user && req.session.user.is_admin) return cb(true);
hooks.aCallFirst("authorize", {req: req, res: res, next: next, resource: req.path}, hookResultMangle(cb)); hooks.aCallFirst("authorize", {req: req, res: res, next: next, resource: req.path}, hookResultMangle(cb));
} };
var authenticate = function(cb) { var authenticate = function(cb) {
// If auth headers are present use them to authenticate... // If auth headers are present use them to authenticate...
if (req.headers.authorization && req.headers.authorization.search('Basic ') === 0) { if (req.headers.authorization && req.headers.authorization.search('Basic ') === 0) {
var userpass = Buffer.from(req.headers.authorization.split(' ')[1], 'base64').toString().split(":") var userpass = Buffer.from(req.headers.authorization.split(' ')[1], 'base64').toString().split(":");
var username = userpass.shift(); var username = userpass.shift();
var password = userpass.join(':'); var password = userpass.join(':');
var fallback = function(success) { var fallback = function(success) {
@ -54,7 +54,7 @@ exports.basicAuth = function(req, res, next) {
return hooks.aCallFirst("authenticate", {req: req, res: res, next: next, username: username, password: password}, hookResultMangle(fallback)); return hooks.aCallFirst("authenticate", {req: req, res: res, next: next, username: username, password: password}, hookResultMangle(fallback));
} }
hooks.aCallFirst("authenticate", {req: req, res: res, next: next}, hookResultMangle(cb)); hooks.aCallFirst("authenticate", {req: req, res: res, next: next}, hookResultMangle(cb));
} };
/* Authentication OR authorization failed. */ /* Authentication OR authorization failed. */
@ -73,7 +73,7 @@ exports.basicAuth = function(req, res, next) {
res.status(401).send('Authentication required'); res.status(401).send('Authentication required');
} }
})); }));
} };
/* This is the actual authentication/authorization hoop. It is done in four steps: /* This is the actual authentication/authorization hoop. It is done in four steps:
@ -97,7 +97,7 @@ exports.basicAuth = function(req, res, next) {
}); });
}); });
}); });
} };
exports.secret = null; exports.secret = null;
@ -105,13 +105,13 @@ exports.expressConfigure = function(hook_name, args, cb) {
// Measure response time // Measure response time
args.app.use(function(req, res, next) { args.app.use(function(req, res, next) {
var stopWatch = stats.timer('httpRequests').start(); var stopWatch = stats.timer('httpRequests').start();
var sendFn = res.send var sendFn = res.send;
res.send = function() { res.send = function() {
stopWatch.end() stopWatch.end();
sendFn.apply(res, arguments) sendFn.apply(res, arguments);
} };
next() next();
}) });
// If the log level specified in the config file is WARN or ERROR the application server never starts listening to requests as reported in issue #158. // If the log level specified in the config file is WARN or ERROR the application server never starts listening to requests as reported in issue #158.
// Not installing the log4js connect logger when the log level has a higher severity than INFO since it would not log at that level anyway. // Not installing the log4js connect logger when the log level has a higher severity than INFO since it would not log at that level anyway.
@ -176,4 +176,4 @@ exports.expressConfigure = function(hook_name, args, cb) {
args.app.use(cookieParser(settings.sessionKey, {})); args.app.use(cookieParser(settings.sessionKey, {}));
args.app.use(exports.basicAuth); args.app.use(exports.basicAuth);
} };