Skip to content

Commit

Permalink
fix: always initialise access levels
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryoverload committed Jan 22, 2025
1 parent 00ff19d commit 1185c0b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/middleware/checkBan.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ const config = require('../../config.json');
const db = require('../database');

async function checkBan(request, response, next) {
// Initialize access levels so the template engine can always access them
response.locals.tester = false;
response.locals.moderator = false;
response.locals.developer = false;

if (!request.user && !request.guest_access && request.path !== '/login') {
return response.status(401).send('Ban Check Failed: No user or guest access');
} else if (!request.user && (request.guest_access || request.path === '/login')) {
Expand Down

0 comments on commit 1185c0b

Please sign in to comment.