session
session copied to clipboard
session regeneration
some method definition is required for reset/regeneration of session. if any please inform.
Why not fix this issue? Could someone give a comment? cause I found it's easy to do.
I also wonder about this. How can I re-create the session? I want to logout current user just before logging in the new one:
// if some user is already logged in destroy his session
if (!ctx.session.isNew) {
ctx.session = null;
}
// login
ctx.session.userId = userId;
Can't getter create new session automatically if necessary?
I tried to do it like this:
ctx.session = null;
await KoaSession(ctx.app).call(this, ctx, next);
But it will throw TypeError: Cannot redefine property: sessionOptions
Not sure if this has been added, but I can't find a reference in the docs. I also have the same use case of destroying/recreating a session in a single call.
@fengmk2 with #221 merged, this can be closed now. 🎉