fixed 500 instead of 401 when auth header missing

pull/20/head
tycrek 3 years ago
parent 4628524534
commit 8add5f7ecd
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -106,6 +106,7 @@ function startup() {
// Block unauthorized requests and attempt token sanitization
app.post('/', (req, res, next) => {
req.headers.authorization = req.headers.authorization || '';
req.token = req.headers.authorization.replace(/[^\da-z]/gi, ''); // Strip anything that isn't a digit or ASCII letter
!verify(req, users) ? res.sendStatus(CODE_UNAUTHORIZED) : next(); // skipcq: JS-0093
});

Loading…
Cancel
Save