mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
在session无效时切换至guest
This commit is contained in:
1 parent
2bf6adbaa0
commit
875bf696e2
4 files changed
+45
-34
No files matched your search
@@ -380,6 +380,15 @@ export class Handler {
|
||||
token.TYPE_TOKEN, 600, { uid: this.session.uid, domainId },
|
||||
),
|
||||
]);
|
||||
if (!this.user) {
|
||||
this.session.uid = 0;
|
||||
[this.user, this.UIContext.token] = await Promise.all([
|
||||
user.getById(domainId, this.session.uid),
|
||||
token.createOrUpdate(
|
||||
token.TYPE_TOKEN, 600, { uid: this.session.uid, domainId },
|
||||
),
|
||||
]);
|
||||
}
|
||||
this.csrfToken = this.getCsrfToken(this.session._id || String.random(32));
|
||||
this.UIContext.csrfToken = this.csrfToken;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user