Skip to content

Commit 435491d

Browse files
committed
refactor: improve encryption process for login form data
1 parent 0960d19 commit 435491d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ui/src/views/login/index.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@ const login = () => {
286286
.finally(() => (loading.value = false))
287287
} else {
288288
const publicKey = forge.pki.publicKeyFromPem(user.rasKey)
289-
const encrypted = publicKey.encrypt(JSON.stringify(loginForm.value), 'RSAES-PKCS1-V1_5')
289+
const jsonData = JSON.stringify(loginForm.value)
290+
const utf8Bytes = forge.util.encodeUtf8(jsonData)
291+
const encrypted = publicKey.encrypt(utf8Bytes, 'RSAES-PKCS1-V1_5')
290292
const encryptedBase64 = forge.util.encode64(encrypted)
291293
user
292294
.login({ encryptedData: encryptedBase64, username: loginForm.value.username })

0 commit comments

Comments
 (0)