From 209922b7780e0e3d18d80c4e80c6b9c10fec50bc Mon Sep 17 00:00:00 2001 From: Carlgo11 Date: Mon, 20 May 2024 01:19:38 +0200 Subject: [PATCH] Add /logout --- routes/authRoutes.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routes/authRoutes.js b/routes/authRoutes.js index efd0f07..ca02de9 100644 --- a/routes/authRoutes.js +++ b/routes/authRoutes.js @@ -10,6 +10,11 @@ app.get('/login', async (req, res) => { res.render('login', {title: 'Log in to continue', backgrounds: req.bg}); }); +app.get('/logout', (req, res) => { + req.session.destroy(); + return res.redirect('/login'); +}); + app.get('/register', async (req, res) => { res.cookie('challenge', crypto.randomUUID(), { maxAge: 1000 * 60,