fix: remove registration endpoint from authentication bypass in middleware (#267)

This commit is contained in:
samanhappy
2025-08-11 14:18:28 +08:00
committed by GitHub
parent 907bca8aac
commit 604fe4f71d

View File

@@ -53,8 +53,8 @@ export const initMiddlewares = (app: express.Application): void => {
// Protect API routes with authentication middleware, but exclude auth endpoints // Protect API routes with authentication middleware, but exclude auth endpoints
app.use(`${config.basePath}/api`, (req, res, next) => { app.use(`${config.basePath}/api`, (req, res, next) => {
// Skip authentication for login and register endpoints // Skip authentication for login endpoint
if (req.path === '/auth/login' || req.path === '/auth/register') { if (req.path === '/auth/login') {
next(); next();
} else { } else {
// Apply authentication middleware first // Apply authentication middleware first