From b91bb0a133aa3d0400beb359fed4e641c888ab26 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 31 Oct 2022 22:40:42 +0100 Subject: Added logout route, and a way to display the logout menu item on relevant pages --- routes/login.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'routes/login.js') diff --git a/routes/login.js b/routes/login.js index 4bcd42f..9684f8a 100644 --- a/routes/login.js +++ b/routes/login.js @@ -13,7 +13,7 @@ router.get("/", (req, res) => { if (req.session.user !== undefined) { return res.redirect(302, "/play"); } - return res.render("login", makeLoginController()); + return res.render("login", makeLoginController(req)); }); const checkUsername = check("username") @@ -28,7 +28,7 @@ router.post("/", [bodyParser, checkUsername, checkPassword], async (req, res) => if (req.session.user !== undefined) { return res.redirect(302, "/play"); } - let controller = makeLoginController(); + let controller = makeLoginController(req); controller.data = req.body; controller.errors = validationResult(req).mapped(); if (Object.keys(controller.errors).length === 0) { -- cgit v1.2.3