fix should toString userId's

This commit is contained in:
Berkeley Martinez
2015-08-18 15:22:28 -07:00
parent 9dcf284825
commit 478ed3c522
3 changed files with 24 additions and 4 deletions

View File

@ -1,10 +1,30 @@
const pathsOfNoReturn = [
'link',
'auth',
'login',
'logout',
'signin',
'signup',
'fonts',
'favicon',
'js',
'css'
];
const pathsOfNoReturnRegex = new RegExp(pathsOfNoReturn.join('|'), 'i');
export default function addReturnToUrl() {
return function(req, res, next) {
// Remember original destination before login.
var path = req.path.split('/')[1];
if (/auth|login|logout|signin|signup|fonts|favicon/i.test(path)) {
if (req.method !== 'GET') {
return next();
} else if (/\/stories\/\w+/i.test(req.path)) {
}
if (pathsOfNoReturnRegex.test(path)) {
return next();
}
if (/\/stories\/\w+/i.test(req.path)) {
return next();
}
req.session.returnTo = req.path;