From ebef80e061a11777fd48d304dc5a2a5d37003fa3 Mon Sep 17 00:00:00 2001 From: sudoer777 <78781902+sudoer777@users.noreply.github.com> Date: Wed, 24 Nov 2021 21:07:13 -0700 Subject: [PATCH] Add logout function --- routes/auth.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routes/auth.js b/routes/auth.js index 53242d5..9b400e5 100644 --- a/routes/auth.js +++ b/routes/auth.js @@ -8,6 +8,11 @@ router.get('/login', (req, res, next) => { res.render('accounts/login', { title : "Login" }); }); +router.get('/logout', (req, res, next) => { + req.logout(); + res.redirect("/"); +}); + router.post('/login', passport.authenticate('local', { failureRedirect: '/fail',