From aa6061d36670c41056f49a46a7fe6b18472f966c Mon Sep 17 00:00:00 2001 From: liutao <790864623@qq.com> Date: Fri, 24 Jul 2026 14:34:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=86=E7=A0=81=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/auth.ts | 12 ++++++++---- src/views/Login/SocialLogin.vue | 7 +++++-- src/views/Login/components/LoginForm.vue | 9 ++++++--- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/utils/auth.ts b/src/utils/auth.ts index d9e85650..45c71a06 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -1,6 +1,5 @@ import { useCache, CACHE_KEY } from '@/hooks/web/useCache' import { TokenType } from '@/api/login/types' -import { decrypt, encrypt } from '@/utils/jsencrypt' const { wsCache } = useCache() @@ -47,14 +46,19 @@ export type LoginFormType = { export const getLoginForm = () => { const loginForm: LoginFormType = wsCache.get(CACHE_KEY.LoginForm) if (loginForm) { - loginForm.password = decrypt(loginForm.password) as string + // Never restore a password from browser storage. Also sanitize legacy cache entries. + loginForm.password = '' + wsCache.set(CACHE_KEY.LoginForm, loginForm, { exp: 30 * 24 * 60 * 60 }) } return loginForm } export const setLoginForm = (loginForm: LoginFormType) => { - loginForm.password = encrypt(loginForm.password) as string - wsCache.set(CACHE_KEY.LoginForm, loginForm, { exp: 30 * 24 * 60 * 60 }) + wsCache.set( + CACHE_KEY.LoginForm, + { ...loginForm, password: '' }, + { exp: 30 * 24 * 60 * 60 } + ) } export const removeLoginForm = () => { diff --git a/src/views/Login/SocialLogin.vue b/src/views/Login/SocialLogin.vue index 202a4b9a..86020dda 100644 --- a/src/views/Login/SocialLogin.vue +++ b/src/views/Login/SocialLogin.vue @@ -58,6 +58,7 @@ label-position="top" label-width="120px" size="large" + autocomplete="off" > @@ -80,6 +81,7 @@ @@ -89,6 +91,7 @@ @@ -31,6 +32,7 @@ @@ -40,6 +42,7 @@