Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected access control and added conditional middleware. #62

Closed
wants to merge 1 commit into from

Conversation

dipyamanroy
Copy link

Previous behavior

Highlighted in Issue #61 that allows unfiltered access to protected pages.

Changes Made

Reordered Middleware:

  • Moved app.use(express.static('public')); below the other app.use statements to ensure proper handling of access control.

Added Conditional Middleware:

  • Introduced a conditional middleware to exclude certain routes from token validation.
  • Defined an array excludedRoutes containing routes that do not require token validation: ['/', '/register', '', '/login'].
  • Implemented a middleware function to check if the request path is in excludedRoutes. If it is, the request proceeds without token validation. Otherwise, validateToken middleware is invoked.

@dipyamanroy
Copy link
Author

Still had some routes missing. Will open a fresh pull with the other auth corrections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant