From cec7fafa62f11ceea87d98920d912d224ed3232d Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sat, 23 Apr 2022 15:33:26 +0200 Subject: [PATCH] Update login redirect --- src/server/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/server/index.js b/src/server/index.js index ac3ee7f..3ec56f0 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -62,9 +62,6 @@ var userProfile; app.use(passport.initialize()); app.use(passport.session()); -app.get('/success', (req, res) => res.send(userProfile)); -// app.get('/error', (req, res) => res.send("error logging in")); - passport.serializeUser(function(user, cb) { cb(null, user); }); @@ -118,7 +115,7 @@ app.get('/auth/google/callback', req.session.user = user; } - res.json({"status": "OK", "data": user}); + res.redirect('/'); return; }) .catch(err => { @@ -449,6 +446,10 @@ function isManager(session) { }); } +api.get("/logout", (req, res) => { + req.session.destroy(); + res.redirect("/"); +}); api.get("/users/getSessionUser", (req, res) => { if (req.session.user) {