From 122427d30db9fb632900ba1d4851bffc93c6c23c Mon Sep 17 00:00:00 2001 From: Shane Maynard Date: Wed, 29 Jul 2026 22:56:06 -0400 Subject: [PATCH] fix: redirect authenticated users to planner --- server/app.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/app.js b/server/app.js index f8ffe95..f4933f1 100644 --- a/server/app.js +++ b/server/app.js @@ -441,9 +441,16 @@ export function createApp({ db, root, env = process.env } = {}) { .json({ ok: false, code: e.code, error: e.message }); } }); - app.get("/", (_q, res) => - res.sendFile(path.join(root, "public", "landing.html")), - ); + app.get("/", async (req, res, next) => { + try { + // Returning users should not be left on the sign-in page after a successful login. + if (await session(req)) return res.status(302).location("/app").end(); + res.set("Cache-Control", "no-store, private"); + res.sendFile(path.join(root, "public", "landing.html")); + } catch (error) { + next(error); + } + }); app.get("/app", requireAuth, (_q, res) => res.sendFile(path.join(root, "public", "index.html")), );