Update login redirect
This commit is contained in:
parent
52514e9e68
commit
cec7fafa62
|
@ -62,9 +62,6 @@ var userProfile;
|
||||||
app.use(passport.initialize());
|
app.use(passport.initialize());
|
||||||
app.use(passport.session());
|
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) {
|
passport.serializeUser(function(user, cb) {
|
||||||
cb(null, user);
|
cb(null, user);
|
||||||
});
|
});
|
||||||
|
@ -118,7 +115,7 @@ app.get('/auth/google/callback',
|
||||||
req.session.user = user;
|
req.session.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json({"status": "OK", "data": user});
|
res.redirect('/');
|
||||||
return;
|
return;
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.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) => {
|
api.get("/users/getSessionUser", (req, res) => {
|
||||||
if (req.session.user) {
|
if (req.session.user) {
|
||||||
|
|
Loading…
Reference in New Issue