mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: update encryption process to use UTF-8 encoding for login form data
This commit is contained in:
parent
9faebd8a41
commit
92e8a9105f
|
|
@ -252,7 +252,9 @@ const loginHandle = () => {
|
|||
})
|
||||
} else {
|
||||
const publicKey = forge.pki.publicKeyFromPem(chatUser?.chat_profile?.rasKey as any);
|
||||
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);
|
||||
chatUser.login({
|
||||
encryptedData: encryptedBase64,
|
||||
|
|
@ -438,10 +440,10 @@ onBeforeMount(() => {
|
|||
console.log('DingTalk client request success:', res)
|
||||
chatUser.dingOauth2Callback(res.code, accessToken).then(() => {
|
||||
router.push({
|
||||
name: 'chat',
|
||||
params: {accessToken: accessToken},
|
||||
query: route.query,
|
||||
})
|
||||
name: 'chat',
|
||||
params: {accessToken: accessToken},
|
||||
query: route.query,
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,7 +201,10 @@ const loginHandle = () => {
|
|||
})
|
||||
} else {
|
||||
const publicKey = forge.pki.publicKeyFromPem(user.rasKey);
|
||||
const encrypted = publicKey.encrypt(JSON.stringify(loginForm.value), 'RSAES-PKCS1-V1_5');
|
||||
// 转换为UTF-8编码后再加密
|
||||
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);
|
||||
login
|
||||
.asyncLogin({encryptedData: encryptedBase64, username: loginForm.value.username})
|
||||
|
|
|
|||
Loading…
Reference in New Issue