fix prevent redirect to /news/hot
This commit is contained in:
@ -26,13 +26,12 @@ export default function addReturnToUrl() {
|
|||||||
return function(req, res, next) {
|
return function(req, res, next) {
|
||||||
// Remember original destination before login.
|
// Remember original destination before login.
|
||||||
var path = req.path.split('/')[1];
|
var path = req.path.split('/')[1];
|
||||||
var subPath = req.path.split('/')[2];
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
req.method !== 'GET' ||
|
req.method !== 'GET' ||
|
||||||
pathsOfNoReturnRegex.test(path) ||
|
pathsOfNoReturnRegex.test(path) ||
|
||||||
!whiteListRegex.test(path) ||
|
!whiteListRegex.test(path) ||
|
||||||
(/news/i).test(path) && (/hot/i).test(subPath)
|
(/news/i).test(path) && (/hot/i).test(req.path)
|
||||||
) {
|
) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user