mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
Merge pull request #3006 from xinnan-tech/captcha-validation-error
fix: 优化验证码验证错误提示
This commit is contained in:
commit
b72967bcc3
1 changed files with 14 additions and 12 deletions
|
|
@ -20,6 +20,7 @@ public class Sm2DecryptUtil {
|
|||
|
||||
/**
|
||||
* 解密SM2加密内容,提取验证码并验证
|
||||
*
|
||||
* @param encryptedPassword SM2加密的密码字符串
|
||||
* @param captchaId 验证码ID
|
||||
* @param captchaService 验证码服务
|
||||
|
|
@ -47,13 +48,14 @@ public class Sm2DecryptUtil {
|
|||
String embeddedCaptcha = decryptedContent.substring(0, CAPTCHA_LENGTH);
|
||||
String actualPassword = decryptedContent.substring(CAPTCHA_LENGTH);
|
||||
|
||||
// 验证嵌入的验证码是否正确
|
||||
boolean embeddedCaptchaValid = captchaService.validate(captchaId, embeddedCaptcha, true);
|
||||
if (!embeddedCaptchaValid) {
|
||||
throw new RenException(ErrorCode.SMS_CAPTCHA_ERROR);
|
||||
}
|
||||
|
||||
return actualPassword;
|
||||
} else if (decryptedContent.length() > 0) {
|
||||
throw new RenException(ErrorCode.SMS_CAPTCHA_ERROR);
|
||||
} else {
|
||||
throw new RenException(ErrorCode.SM2_DECRYPT_ERROR);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue