Skip to content

create-a-container: use authentication checking middleware #58

@runleveldev

Description

@runleveldev

Issue: Centralize authentication logic using middleware and add login redirect support

Description:
Endpoints currently perform authentication checks manually, e.g.:

if (!req.session.user) {

This duplicates logic across routes and makes maintenance error-prone.

Recommendation:

  • Implement a shared authentication middleware that validates the session and either continues or redirects to the login page.
  • Add a redirect query parameter to the login page so users are returned to their original destination after successful authentication.

Benefits:

  • Reduces code duplication and improves consistency
  • Simplifies adding new protected routes
  • Provides smoother user experience with post-login redirects

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions