Update login redirect

This commit is contained in:
Felix Albrigtsen 2022-04-23 15:33:26 +02:00
parent 52514e9e68
commit cec7fafa62
1 changed files with 5 additions and 4 deletions

View File

@ -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) {