diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2019-12-03 21:43:47 -0500 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-12-03 21:43:47 -0500 |
commit | 26fc5559314960c9cb186f56052b69e4f7d30f74 (patch) | |
tree | 5cbf528e6e6e3859c74ac351fb23150b7559a0c1 | |
parent | a9997d9148325b68f6335c0401cd92414dd29081 (diff) |
secured root route access without authentication
-rw-r--r-- | src/server/Initialization.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/server/Initialization.ts b/src/server/Initialization.ts index 2e87c7a1a..6fe67f2c7 100644 --- a/src/server/Initialization.ts +++ b/src/server/Initialization.ts @@ -38,13 +38,16 @@ export default async function InitializeServer(options: InitializationOptions) { app.use(express.static(publicDirectory)); app.use("/images", express.static(publicDirectory)); - app.use("*", ({ user, originalUrl }, _res, next) => { + app.use("*", ({ user, originalUrl }, res, next) => { if (user && !originalUrl.includes("Heartbeat")) { const userEmail = user.email; if (userEmail) { timeMap[userEmail] = Date.now(); } } + if (!user && originalUrl === "/") { + return res.redirect("/login"); + } next(); }); |