From 22a619d9c7d5e5a2f916b808b9b5d69836806208 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 20 Jan 2015 19:30:02 -0500 Subject: [PATCH] fixed #2631 --- src/middleware/middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware/middleware.js b/src/middleware/middleware.js index 2d5faace76..111b0b1ceb 100644 --- a/src/middleware/middleware.js +++ b/src/middleware/middleware.js @@ -69,7 +69,7 @@ middleware.redirectToAccountIfLoggedIn = function(req, res, next) { middleware.redirectToLoginIfGuest = function(req, res, next) { if (!req.user || parseInt(req.user.uid, 10) === 0) { - req.session.returnTo = nconf.get('relative_path') + req.url; + req.session.returnTo = nconf.get('relative_path') + req.url.replace(/^\/api/, ''); return res.redirect(nconf.get('relative_path') + '/login'); } else { next();