mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 23:19:29 +00:00
Made auth middleware more readable
This commit is contained in:
2
app.js
2
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();
|
||||
|
||||
Reference in New Issue
Block a user