mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 22:59:28 +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
|
// Extract the first component of the path from the request
|
||||||
const path = `/${req.path.split('/')?.[1] ?? ''}`;
|
const path = `/${req.path.split('/')?.[1] ?? ''}`;
|
||||||
|
|
||||||
if (!(allowed.includes(path) || req.session.authenticated))
|
if (!allowed.includes(path) && !req.session.authenticated)
|
||||||
return res.redirect('/login');
|
return res.redirect('/login');
|
||||||
|
|
||||||
next();
|
next();
|
||||||
|
|||||||
Reference in New Issue
Block a user