From 67d15db4eee2d2e0f81500bd7aae83c518504293 Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 24 Feb 2022 13:52:38 +0000 Subject: [PATCH] Made auth middleware more readable --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index a085b94..a92db9c 100644 --- a/app.js +++ b/app.js @@ -97,7 +97,7 @@ async function main() { // Extract the first component of the path from the request const path = `/${req.path.split('/')?.[1] ?? ''}`; - if (!(allowed.includes(path) || req.session.authenticated)) + if (!allowed.includes(path) && !req.session.authenticated) return res.redirect('/login'); next();