fix: captcha aes encrypt
parent
1b4335760b
commit
7f3e2a90ae
|
@ -21,9 +21,9 @@ export const AES = {
|
|||
if (!key) {
|
||||
throw new Error('AES 加密密钥不能为空');
|
||||
}
|
||||
if (key.length !== 32) {
|
||||
if (key.length !== 32 && key.length !== 16) {
|
||||
throw new Error(
|
||||
`AES 加密密钥长度必须为 32 位,当前长度: ${key.length}`,
|
||||
`AES 加密密钥长度必须为 32 位或 16 位,当前长度: ${key.length}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ import {
|
|||
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
import { aesEncrypt } from './utils/ase';
|
||||
import { AES } from '@vben-core/shared/utils';
|
||||
|
||||
import { resetSize } from './utils/util';
|
||||
|
||||
const props = withDefaults(defineProps<VerificationProps>(), {
|
||||
|
@ -179,7 +180,7 @@ function end() {
|
|||
const data = {
|
||||
captchaType: captchaType.value,
|
||||
pointJson: secretKey.value
|
||||
? aesEncrypt(
|
||||
? AES.encrypt(
|
||||
JSON.stringify({ x: moveLeftDistance, y: 5 }),
|
||||
secretKey.value,
|
||||
)
|
||||
|
@ -205,7 +206,7 @@ function end() {
|
|||
tipWords.value = `${((endMovetime.value - startMoveTime.value) / 1000).toFixed(2)}s
|
||||
${$t('ui.captcha.title')}`;
|
||||
const captchaVerification = secretKey.value
|
||||
? aesEncrypt(
|
||||
? AES.encrypt(
|
||||
`${backToken.value}---${JSON.stringify({ x: moveLeftDistance, y: 5 })}`,
|
||||
secretKey.value,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue