From 54e06aa44a3134dfc42db3e4b473abf5e181fc42 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 19 Nov 2022 18:41:35 +0100 Subject: cleaned up the distinction between routes and controllers --- controllers/root/logout.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 controllers/root/logout.js (limited to 'controllers/root/logout.js') diff --git a/controllers/root/logout.js b/controllers/root/logout.js new file mode 100644 index 0000000..078df9a --- /dev/null +++ b/controllers/root/logout.js @@ -0,0 +1,7 @@ +export function logout_get(req, res) { + if (req.session.user !== undefined) { + res.clearCookie("JDMSessionId"); + req.session.destroy(); + } + return res.redirect(302, "/"); +} -- cgit v1.2.3