新增前端密码加密工具
This commit is contained in:
14
ruoyi-ui/src/utils/passwordTransfer.js
Normal file
14
ruoyi-ui/src/utils/passwordTransfer.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import CryptoJS from 'crypto-js'
|
||||
|
||||
export function encryptPasswordFields(payload, fields, key) {
|
||||
const next = { ...payload }
|
||||
fields.forEach((field) => {
|
||||
if (next[field]) {
|
||||
next[field] = CryptoJS.AES.encrypt(next[field], CryptoJS.enc.Utf8.parse(key), {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
}).toString()
|
||||
}
|
||||
})
|
||||
return next
|
||||
}
|
||||
Reference in New Issue
Block a user