refactor(auth): remove debug logging and enhance session middleware
- Eliminated extensive debug logging from the login strategy and verification endpoint to streamline the authentication process. - Updated session middleware to improve cookie handling, enabling proxy support and adjusting session creation behavior. - Ensured secure cookie settings for cross-origin requests in production environments.
This commit is contained in:
@@ -17,19 +17,7 @@ const options = (key: string): passport.AuthenticateOptions => ({
|
||||
successRedirect: `/secure/verify?strategy=${key}`
|
||||
});
|
||||
|
||||
// Debug middleware for login
|
||||
const loginDebugMiddleware = (req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
console.log("=== LOGIN ROUTE HIT ===");
|
||||
console.log("Request method:", req.method);
|
||||
console.log("Request URL:", req.url);
|
||||
console.log("Request body:", req.body);
|
||||
console.log("Content-Type:", req.headers["content-type"]);
|
||||
console.log("Session ID:", req.sessionID);
|
||||
console.log("Is authenticated before:", req.isAuthenticated());
|
||||
next();
|
||||
};
|
||||
|
||||
authRouter.post("/login", loginDebugMiddleware, passport.authenticate("local-login", options("login")));
|
||||
authRouter.post("/login", passport.authenticate("local-login", options("login")));
|
||||
authRouter.post("/signup", signUpValidator, passwordValidator, passport.authenticate("local-signup", options("signup")));
|
||||
authRouter.post("/signup/check", signUpValidator, passwordValidator, safeControllerFunction(AuthController.status_check));
|
||||
authRouter.get("/verify", AuthController.verify);
|
||||
|
||||
Reference in New Issue
Block a user