Skip to content

Commit

Permalink
fix: Check for undefined before redirecting
Browse files Browse the repository at this point in the history
  • Loading branch information
impactmass committed Sep 21, 2018
1 parent 31a73ef commit 9385756
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ app
// This endpoint handles OAuth2 requests (exchanges code for token)
server.get("/callback", passport.authenticate("oauth2"), (req, res) => {
// After success, redirect to the page we came from originally
res.redirect(req.session.redirectTo);
res.redirect(req.session.redirectTo || "/");
});

server.get("/logout", (req, res) => {
req.logout();
res.redirect(req.get("Referer"));
res.redirect(req.get("Referer") || "/");
});

// Setup next routes
Expand Down

0 comments on commit 9385756

Please sign in to comment.