Authored by xuhongyun

支持将登录时返回的phpsession保存到cookie中

... ... @@ -9,6 +9,18 @@ module.exports=function(app) {
app.post("/login", "common_login", function (login, req, res){
if (login.code == 200) {
if (req.session.gray) {
// 登录成功后,将phpsession保存下来
var gray_cookie = req.session.gray.replace(/[\[|\]]/g, '').split(';');
gray_cookie.forEach(function (n) {
console.log(n);
var item = n.split("=");
if (item.length > 1 && item[0] == "PHPSESSID") {
res.cookie(item[0], item[1], { maxAge: 7200000, httpOnly: true });
}
});
res.cookie('domain', '.yohobuy.com', { maxAge: 7200000, httpOnly: true });
}
res.myRedirect('/');
} else {
res.myRedirect('/login');
... ...