mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 01:38:19 +08:00
core: delete old session after recreate (#1173)
This commit is contained in:
1 parent
3cc13252e8
commit
8d76be8f0b
1 file changed
+1
@@ -57,6 +57,7 @@ export default async (ctx: KoaContext, next: Next) => {
|
||||
if (ctx.session._id && !ctx.session.recreate) {
|
||||
await token.update(ctx.session._id, token.TYPE_SESSION, expireSeconds, omit(ctx.session, ['_id', 'recreate']));
|
||||
} else {
|
||||
if (ctx.session._id) await token.del(ctx.session._id, token.TYPE_SESSION);
|
||||
Object.assign(ctx.session, { createIp: request.ip, createUa: ua, createHost: request.host });
|
||||
[ctx.session._id] = await token.add(token.TYPE_SESSION, expireSeconds, omit(ctx.session, ['_id', 'recreate']));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user