diff --git a/mail-vue/src/layout/header/index.vue b/mail-vue/src/layout/header/index.vue index 66af99c..ea8e881 100644 --- a/mail-vue/src/layout/header/index.vue +++ b/mail-vue/src/layout/header/index.vue @@ -131,7 +131,7 @@ function clickLogout() { logoutLoading.value = true logout().then(() => { localStorage.removeItem("token") - router.push('/login') + router.replace('/login') }).finally(() => { logoutLoading.value = false }) diff --git a/mail-worker/src/security/security.js b/mail-worker/src/security/security.js index bec5e50..27de3a8 100644 --- a/mail-worker/src/security/security.js +++ b/mail-worker/src/security/security.js @@ -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); }); diff --git a/mail-worker/src/service/login-service.js b/mail-worker/src/service/login-service.js index f905d3f..99de6fc 100644 --- a/mail-worker/src/service/login-service.js +++ b/mail-worker/src/service/login-service.js @@ -96,6 +96,10 @@ const loginService = { if (authInfo) { + if (authInfo.tokens.length > 10) { + authInfo.tokens.shift(); + } + authInfo.tokens.push(uuid); } else { diff --git a/mail-worker/src/utils/jwt-utils.js b/mail-worker/src/utils/jwt-utils.js index cae2ebc..424fb2b 100644 --- a/mail-worker/src/utils/jwt-utils.js +++ b/mail-worker/src/utils/jwt-utils.js @@ -79,6 +79,7 @@ const jwtUtils = { return payload; } catch (err) { + console.log(err) return null; } }