Skip to content

Commit 44e2dab

Browse files
authored
Fix the signin and logout redirect url might be empty
1 parent e3a31bc commit 44e2dab

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

app.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,10 @@ if (config.facebook) {
256256
//facebook auth callback
257257
app.get('/auth/facebook/callback',
258258
passport.authenticate('facebook', {
259-
failureRedirect: config.serverurl
259+
failureRedirect: config.serverurl + '/'
260260
}),
261261
function (req, res) {
262-
res.redirect(config.serverurl);
262+
res.redirect(config.serverurl + '/');
263263
});
264264
}
265265
//twitter auth
@@ -269,10 +269,10 @@ if (config.twitter) {
269269
//twitter auth callback
270270
app.get('/auth/twitter/callback',
271271
passport.authenticate('twitter', {
272-
failureRedirect: config.serverurl
272+
failureRedirect: config.serverurl + '/'
273273
}),
274274
function (req, res) {
275-
res.redirect(config.serverurl);
275+
res.redirect(config.serverurl + '/');
276276
});
277277
}
278278
//github auth
@@ -282,10 +282,10 @@ if (config.github) {
282282
//github auth callback
283283
app.get('/auth/github/callback',
284284
passport.authenticate('github', {
285-
failureRedirect: config.serverurl
285+
failureRedirect: config.serverurl + '/'
286286
}),
287287
function (req, res) {
288-
res.redirect(config.serverurl);
288+
res.redirect(config.serverurl + '/');
289289
});
290290
//github callback actions
291291
app.get('/auth/github/callback/:noteId/:action', response.githubActions);
@@ -297,10 +297,10 @@ if (config.gitlab) {
297297
//gitlab auth callback
298298
app.get('/auth/gitlab/callback',
299299
passport.authenticate('gitlab', {
300-
failureRedirect: config.serverurl
300+
failureRedirect: config.serverurl + '/'
301301
}),
302302
function (req, res) {
303-
res.redirect(config.serverurl);
303+
res.redirect(config.serverurl + '/');
304304
});
305305
//gitlab callback actions
306306
app.get('/auth/gitlab/callback/:noteId/:action', response.gitlabActions);
@@ -312,10 +312,10 @@ if (config.dropbox) {
312312
//dropbox auth callback
313313
app.get('/auth/dropbox/callback',
314314
passport.authenticate('dropbox-oauth2', {
315-
failureRedirect: config.serverurl
315+
failureRedirect: config.serverurl + '/'
316316
}),
317317
function (req, res) {
318-
res.redirect(config.serverurl);
318+
res.redirect(config.serverurl + '/');
319319
});
320320
}
321321
//google auth
@@ -325,18 +325,18 @@ if (config.google) {
325325
//google auth callback
326326
app.get('/auth/google/callback',
327327
passport.authenticate('google', {
328-
failureRedirect: config.serverurl
328+
failureRedirect: config.serverurl + '/'
329329
}),
330330
function (req, res) {
331-
res.redirect(config.serverurl);
331+
res.redirect(config.serverurl + '/');
332332
});
333333
}
334334
//logout
335335
app.get('/logout', function (req, res) {
336336
if (config.debug && req.isAuthenticated())
337337
logger.info('user logout: ' + req.user.id);
338338
req.logout();
339-
res.redirect(config.serverurl);
339+
res.redirect(config.serverurl + '/');
340340
});
341341
//get history
342342
app.get('/history', function (req, res) {
@@ -537,4 +537,4 @@ process.on('SIGINT', function () {
537537
});
538538
}
539539
}, 100);
540-
});
540+
});

0 commit comments

Comments
 (0)