0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Merge pull request #5278 from ErisDS/password-imrpv

Password protect redirect optimisation
This commit is contained in:
Sebastian Gierlinger 2015-05-17 13:48:10 +02:00
commit f2228ab0a4

View file

@ -389,13 +389,16 @@ middleware = {
authenticatePrivateSession: function (req, res, next) {
var hash = req.session.token || '',
salt = req.session.salt || '';
salt = req.session.salt || '',
url;
return verifySessionHash(salt, hash).then(function (isVerified) {
if (isVerified) {
return next();
} else {
return res.redirect(config.urlFor({relativeUrl: '/private/'}) + '?r=' + encodeURIComponent(req.url));
url = config.urlFor({relativeUrl: '/private/'});
url += req.url === '/' ? '' : '?r=' + encodeURIComponent(req.url);
return res.redirect(url);
}
});
},