From 435491d9e6d46bc00df7ae7c746ecc9a465e55ca Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 22 Oct 2025 16:42:19 +0800 Subject: [PATCH] refactor: improve encryption process for login form data --- ui/src/views/login/index.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/src/views/login/index.vue b/ui/src/views/login/index.vue index a46f2991d..d4264406a 100644 --- a/ui/src/views/login/index.vue +++ b/ui/src/views/login/index.vue @@ -286,7 +286,9 @@ const login = () => { .finally(() => (loading.value = false)) } else { const publicKey = forge.pki.publicKeyFromPem(user.rasKey) - const encrypted = publicKey.encrypt(JSON.stringify(loginForm.value), 'RSAES-PKCS1-V1_5') + const jsonData = JSON.stringify(loginForm.value) + const utf8Bytes = forge.util.encodeUtf8(jsonData) + const encrypted = publicKey.encrypt(utf8Bytes, 'RSAES-PKCS1-V1_5') const encryptedBase64 = forge.util.encode64(encrypted) user .login({ encryptedData: encryptedBase64, username: loginForm.value.username })