Implement automatic logout after inactivity and improve authentication

Adds session timeout functionality using `useSessionTimeout` hook and updates session maxAge to 15 minutes in server routes.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: dec54137-d5a2-4406-8ad4-5f2f9fb110bf
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/56f97713-69fd-41d1-b933-ff4440458da0.jpg
This commit is contained in:
michaelschal committed 2025-07-10 09:51:34 +00:00
1 parent 0db1bffa94
commit f828278efa
3 files changed
+116 -1

No files matched your search

+10 -1
View File
@@ -61,7 +61,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
saveUninitialized: false,
cookie: {
secure: false, // Set to true in production with HTTPS
maxAge: 24 * 60 * 60 * 1000 // 24 hours
maxAge: 15 * 60 * 1000 // 15 minutes
}
}));
@@ -96,6 +96,15 @@ export async function registerRoutes(app: Express): Promise<Server> {
}
});
app.get('/api/auth/logout', (req, res) => {
req.session.destroy((err) => {
if (err) {
console.error('Logout error:', err);
}
res.redirect('/');
});
});
app.post('/api/auth/logout', (req, res) => {
req.session.destroy((err) => {
if (err) {