fix should toString userId's
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user