Skip to content

Commit

Permalink
refactor(utils.ts): modify the 'key' and 'iv' for encrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
oucb committed May 31, 2024
1 parent 5d55596 commit 9faf61f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,12 @@ export const randomString = (stringLen: number): string => {

export const encryptStr = (str: string): string => {
const utf8Str = CryptoJS.enc.Utf8.parse(str)
const kStr = '0000neuronex0000'
const encrypted = CryptoJS.AES.encrypt(utf8Str, kStr, {
iv: kStr,
const key = CryptoJS.enc.Base64.parse('Wi02CrYTNIJtl8r8+LGII+rMvAJI1880FgXBNOTgnRw=')
const iv = CryptoJS.enc.Base64.parse('7+OE7gThf0PKTR9Py0aVhA==')
const encrypted = CryptoJS.AES.encrypt(utf8Str, key, {
iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7,
})
return encrypted.ciphertext.toString()
return encrypted.toString()
}
3 changes: 3 additions & 0 deletions src/views/admin/Password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,14 @@ const checkNewPassMatch = (rule: any, value: string, callback: any) => {
if (newPassConfirm) {
form.validateField(['newPassConfirm'])
}
callback()
}
const checkNewPassConfirmMatch = (rule: any, value: string, callback: any) => {
if (!isNewPassMatch.value) {
callback(new Error(`${t('common.newPassNotMatch')}`))
} else {
callback()
}
}
Expand Down

0 comments on commit 9faf61f

Please sign in to comment.