mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-07 10:20:57 +00:00
perf: password 等使用 rsa 加密传输 (#8188)
* perf: 修改 model fields 路径 * stash it * pref: 统一加密方式,密码字段采用 rsa 加密 * pref: 临时密码使用 rsa * perf: 去掉 debug msg * perf: 去掉 Debug * perf: 去掉 debug * perf: 抽出来 Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
@@ -1501,3 +1501,19 @@ function getStatusIcon(status, mapping, title) {
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
function encryptPassword(password) {
|
||||
if (!password) {
|
||||
return ''
|
||||
}
|
||||
var rsaPublicKeyText = getCookie('jms_public_key')
|
||||
.replaceAll('"', '')
|
||||
var rsaPublicKey = atob(rsaPublicKeyText)
|
||||
var jsencrypt = new JSEncrypt(); //加密对象
|
||||
jsencrypt.setPublicKey(rsaPublicKey); // 设置密钥
|
||||
var value = jsencrypt.encrypt(password); //加密
|
||||
return value
|
||||
}
|
||||
|
||||
|
||||
window.encryptPassword = encryptPassword
|
||||
|
Reference in New Issue
Block a user