mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Password protect redirect optimisation
no issue - Don't include r=%2F in the URL - we'll assume this is the default - This is just a bit prettier
This commit is contained in:
parent
eecfe7241e
commit
4de1c29538
1 changed files with 5 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue