nodejs connect session middleware don't set cookie? -
i use connect's session middleware in express app,in session's document can find
req.session.cookie.maxage req.session.cookie.expries
i set value them, in browser, still can't see cookie's expries changed.
i try set req.session.cookie.maxage
false
,then res.cookie()
set maxage value time,ok time,it worked. req.session.cookie.maxage
seemd rewrite cookie's maxage,so written in res.cookie()
lost, in browser see "session" cookie.
what want implement "remember me" functionality.so wrong? thanks.
my app.js config:
app.use(express.cookieparser('your secret here')); app.use(express.session({ secret: 'secret', store: new mongostore({ db: settings.mongosessiondb }), key: "sid" }));
in login.js:
if(req.body.remember){ req.session.cookie.maxage = 1000 * 60 * 60 * 24 * 30;//this not work, didn't reflesh brower }else{ req.session.cookie.expires = false;//this work, refresh browser cookie }
Comments
Post a Comment