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:
commit
f2228ab0a4
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