Authored by 姜敏

Merge branch 'release/1.6' of http://git.dev.yoho.cn/platform/yohobuy-portal-fe into release/1.6

... ... @@ -42,24 +42,24 @@ exports.post = function(data, req, res) {
}
}
req.app.logger.log('verbose','gray login options:',options);
// request(options,function(err,ress,body){
// if(!err) {
// //cookie透传到老系统
// var cookie = ress.caseless.get('set-cookie');
// req.app.logger.log('verbose','login old server response http headers:',ress.caseless);
// req.app.logger.log('verbose','login gray cookie:',cookie);
// //如果没有设置到session
// if(cookie && cookie.length>0) {
// req.session.gray = cookie[0];
// }
// //跳转
// res.redirect(url);
request(options,function(err,ress,body){
if(!err) {
//cookie透传到老系统
var cookie = ress.caseless.get('set-cookie');
req.app.logger.log('verbose','login old server response http headers:',ress.caseless);
req.app.logger.log('verbose','login gray cookie:',cookie);
//如果没有设置到session
if(cookie && cookie.length>0) {
req.session.gray = cookie[0];
}
//跳转
res.redirect(url);
// } else {
// res.render('error/error_nolayout',{message:'用户名或者密码错误!',layout:false,cssfile:CSS_FILE});
// }
// });
res.redirect(url);
} else {
res.render('error/error_nolayout',{message:'用户名或者密码错误!',layout:false,cssfile:CSS_FILE});
}
});
// res.redirect(url);
return;
} else {
... ...
... ... @@ -3,7 +3,7 @@
* @type {Object}
*/
module.exports = {
url:'http://admin.yohobuy.com',//'http://admin.portal.yohobuy.com',
url:'http://admin.portal.yohobuy.com',
sessionKeep:'/account/profile/display',
timeout:30000
};
\ No newline at end of file
... ...
... ... @@ -79,28 +79,28 @@ module.exports = function(req, res, next) {
}
//访问路由路径
var path = req.route?req.route.path:filterOriginalUrl(req.originalUrl);
// if(req.session.user) {
// if(guestAccessList[method+":"+path]){
// nextRedirect(method,path);
// return;
// }
// /*判断权限*/
// if(path&&req.session.user.allRight[path]){
// author.validateAuthor(req.session.user.auth.pid,req.session.user.auth.role_id,path,function(data){
// if(data.code!=200){
// res.status(403);
// res.render('error/error_nolayout',{message:NO_AUTH,layout:false,cssfile:CSS_FILE});
// return;
// }
// nextRedirect(method,path);
// });
// }else{
// nextRedirect(method,path);
// }
// }else{
// nextRedirect(method,path);
// }
nextRedirect(method,path);
if(req.session.user) {
if(guestAccessList[method+":"+path]){
nextRedirect(method,path);
return;
}
/*判断权限*/
if(path&&req.session.user.allRight[path]){
author.validateAuthor(req.session.user.auth.pid,req.session.user.auth.role_id,path,function(data){
if(data.code!=200){
res.status(403);
res.render('error/error_nolayout',{message:NO_AUTH,layout:false,cssfile:CSS_FILE});
return;
}
nextRedirect(method,path);
});
}else{
nextRedirect(method,path);
}
}else{
nextRedirect(method,path);
}
// nextRedirect(method,path);
}
/**
... ...
... ... @@ -81,7 +81,7 @@ module.exports = function(proxyRoute) {
});
} else {
request(options).pipe(ress);//如果是静态资源,直接管道传递结果
}
}
} else {
//当不是老系统的URL,需要访问老系统保持session
... ...