Closed fred1218 closed 4 years ago
打开登录页时:
do login: 输出见第一张图,为嘛sessionId没变化。。
。。我的错,,yield
await co(ctx.regenerateSession())
这样就Ok了,。。不过大神干嘛不重构下代码完美支持KOA2,感觉在koa2中这样用不伦不类啊。。。。
I am seeing this problem too. Calls to await ctx.regenerateSession()
seem to do nothing. Turning on debug, I never see the debug('regenerating session');
message. It's possible this does not work with Koa v2. I'm using the conversion posted here: https://github.com/koajs/generic-session/issues/59
@donggw2030521 I switched over to using https://github.com/longztian/koa-session-minimal
It's a drop in replacement for this library and supports Koa v2 async/await. The only difference I've found is you call await ctx.sessionHandler.regenerateId();
to get a new session id.
this.regenerateSession,你文档中说
但是,我在保存session时,调用这个方法,为什么sessionid还是同一个,你源码里加那个判断干嘛,,,我需要sessionId不同,以配合安全测试