mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fix logout all sessions behavior (#1178)
This commit is contained in:
1 parent
809d1ac6ad
commit
dc5bcff952
2 files changed
+5
-3
No files matched your search
@@ -281,7 +281,7 @@ class HomeSecurityHandler extends Handler {
|
||||
}
|
||||
|
||||
async postDeleteAllTokens() {
|
||||
await token.delByUid(this.user._id);
|
||||
await token.delByUid(this.user._id, token.TYPE_SESSION);
|
||||
this.response.redirect = this.url('user_login');
|
||||
}
|
||||
|
||||
|
||||
@@ -102,8 +102,10 @@ class TokenModel {
|
||||
}
|
||||
|
||||
@ArgMethod
|
||||
static delByUid(uid: number) {
|
||||
return TokenModel.coll.deleteMany({ uid });
|
||||
static delByUid(uid: number, tokenType?: number) {
|
||||
const filter: Filter<TokenDoc> = { uid };
|
||||
if (tokenType !== undefined) filter.tokenType = tokenType;
|
||||
return TokenModel.coll.deleteMany(filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user