Update returnTo middleware
by default express doesn't do case sensitive routing, so `/login` & '/LogIn' are treated same.
This commit is contained in:
2
app.js
2
app.js
@ -87,7 +87,7 @@ app.use(function(req, res, next) {
|
|||||||
// Keep track of previous URL
|
// Keep track of previous URL
|
||||||
if (req.method !== 'GET') return next();
|
if (req.method !== 'GET') return next();
|
||||||
var path = req.path.split('/')[1];
|
var path = req.path.split('/')[1];
|
||||||
if (/(auth|login|logout|signup)$/.test(path)) return next();
|
if (/(auth|login|logout|signup)$/i.test(path)) return next();
|
||||||
req.session.returnTo = req.path;
|
req.session.returnTo = req.path;
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user