Fix the signin and logout redirect url might be empty

This commit is contained in:
Max Wu 2016-07-08 13:37:41 +08:00 committed by GitHub
parent e3a31bc732
commit 44e2dab9ee
1 changed files with 14 additions and 14 deletions

26
app.js
View File

@ -256,10 +256,10 @@ if (config.facebook) {
//facebook auth callback //facebook auth callback
app.get('/auth/facebook/callback', app.get('/auth/facebook/callback',
passport.authenticate('facebook', { passport.authenticate('facebook', {
failureRedirect: config.serverurl failureRedirect: config.serverurl + '/'
}), }),
function (req, res) { function (req, res) {
res.redirect(config.serverurl); res.redirect(config.serverurl + '/');
}); });
} }
//twitter auth //twitter auth
@ -269,10 +269,10 @@ if (config.twitter) {
//twitter auth callback //twitter auth callback
app.get('/auth/twitter/callback', app.get('/auth/twitter/callback',
passport.authenticate('twitter', { passport.authenticate('twitter', {
failureRedirect: config.serverurl failureRedirect: config.serverurl + '/'
}), }),
function (req, res) { function (req, res) {
res.redirect(config.serverurl); res.redirect(config.serverurl + '/');
}); });
} }
//github auth //github auth
@ -282,10 +282,10 @@ if (config.github) {
//github auth callback //github auth callback
app.get('/auth/github/callback', app.get('/auth/github/callback',
passport.authenticate('github', { passport.authenticate('github', {
failureRedirect: config.serverurl failureRedirect: config.serverurl + '/'
}), }),
function (req, res) { function (req, res) {
res.redirect(config.serverurl); res.redirect(config.serverurl + '/');
}); });
//github callback actions //github callback actions
app.get('/auth/github/callback/:noteId/:action', response.githubActions); app.get('/auth/github/callback/:noteId/:action', response.githubActions);
@ -297,10 +297,10 @@ if (config.gitlab) {
//gitlab auth callback //gitlab auth callback
app.get('/auth/gitlab/callback', app.get('/auth/gitlab/callback',
passport.authenticate('gitlab', { passport.authenticate('gitlab', {
failureRedirect: config.serverurl failureRedirect: config.serverurl + '/'
}), }),
function (req, res) { function (req, res) {
res.redirect(config.serverurl); res.redirect(config.serverurl + '/');
}); });
//gitlab callback actions //gitlab callback actions
app.get('/auth/gitlab/callback/:noteId/:action', response.gitlabActions); app.get('/auth/gitlab/callback/:noteId/:action', response.gitlabActions);
@ -312,10 +312,10 @@ if (config.dropbox) {
//dropbox auth callback //dropbox auth callback
app.get('/auth/dropbox/callback', app.get('/auth/dropbox/callback',
passport.authenticate('dropbox-oauth2', { passport.authenticate('dropbox-oauth2', {
failureRedirect: config.serverurl failureRedirect: config.serverurl + '/'
}), }),
function (req, res) { function (req, res) {
res.redirect(config.serverurl); res.redirect(config.serverurl + '/');
}); });
} }
//google auth //google auth
@ -325,10 +325,10 @@ if (config.google) {
//google auth callback //google auth callback
app.get('/auth/google/callback', app.get('/auth/google/callback',
passport.authenticate('google', { passport.authenticate('google', {
failureRedirect: config.serverurl failureRedirect: config.serverurl + '/'
}), }),
function (req, res) { function (req, res) {
res.redirect(config.serverurl); res.redirect(config.serverurl + '/');
}); });
} }
//logout //logout
@ -336,7 +336,7 @@ app.get('/logout', function (req, res) {
if (config.debug && req.isAuthenticated()) if (config.debug && req.isAuthenticated())
logger.info('user logout: ' + req.user.id); logger.info('user logout: ' + req.user.id);
req.logout(); req.logout();
res.redirect(config.serverurl); res.redirect(config.serverurl + '/');
}); });
//get history //get history
app.get('/history', function (req, res) { app.get('/history', function (req, res) {