mirror of
https://github.com/schroinerxy/cloud-mail.git
synced 2026-06-22 03:45:52 +08:00
优化登录身份缓存机制
This commit is contained in:
@@ -92,7 +92,6 @@ app.use('*', async (c, next) => {
|
||||
const result = await jwtUtils.verifyToken(c, jwt);
|
||||
|
||||
if (!result) {
|
||||
console.error(401,1)
|
||||
throw new BizError('身份认证失效,请重新登录', 401);
|
||||
}
|
||||
|
||||
@@ -100,16 +99,13 @@ app.use('*', async (c, next) => {
|
||||
const authInfo = await c.env.kv.get(KvConst.AUTH_INFO + userId, { type: 'json' });
|
||||
|
||||
if (!authInfo) {
|
||||
console.error(401,2)
|
||||
throw new BizError('身份认证失效,请重新登录', 401);
|
||||
}
|
||||
|
||||
if (!authInfo.tokens.includes(token)) {
|
||||
console.error(401,3)
|
||||
throw new BizError('身份认证失效,请重新登录', 401);
|
||||
}
|
||||
|
||||
|
||||
const permIndex = requirePerms.findIndex(item => {
|
||||
return path.startsWith(item);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user