diff --git a/continew-admin-webapi/src/main/java/top/continew/admin/controller/common/CaptchaController.java b/continew-admin-webapi/src/main/java/top/continew/admin/controller/common/CaptchaController.java index c8b9a9de0..ff5455a33 100644 --- a/continew-admin-webapi/src/main/java/top/continew/admin/controller/common/CaptchaController.java +++ b/continew-admin-webapi/src/main/java/top/continew/admin/controller/common/CaptchaController.java @@ -140,7 +140,12 @@ public CaptchaResp getImageCaptcha() { @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX + "DAY'", key = "#email + ':' + T(cn.hutool.extra.spring.SpringUtil).getProperty('captcha.mail.templatePath')", rate = 20, interval = 24, unit = RateIntervalUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX, key = "#email", rate = 100, interval = 24, unit = RateIntervalUnit.HOURS, message = "获取验证码操作太频繁,请稍后再试"), @RateLimiter(name = CacheConstants.CAPTCHA_KEY_PREFIX, key = "#email", rate = 30, interval = 1, unit = RateIntervalUnit.MINUTES, type = LimitType.IP, message = "获取验证码操作太频繁,请稍后再试")}) - public R getMailCaptcha(@NotBlank(message = "邮箱不能为空") @Pattern(regexp = RegexPool.EMAIL, message = "邮箱格式错误") String email) throws MessagingException { + public R getMailCaptcha(@NotBlank(message = "邮箱不能为空") @Pattern(regexp = RegexPool.EMAIL, message = "邮箱格式错误") String email, + CaptchaVO captchaReq) throws MessagingException { + // 行为验证码校验 + ResponseModel verificationRes = behaviorCaptchaService.verification(captchaReq); + ValidationUtils.throwIfNotEqual(verificationRes.getRepCode(), RepCodeEnum.SUCCESS.getCode(), verificationRes + .getRepMsg()); // 生成验证码 CaptchaProperties.CaptchaMail captchaMail = captchaProperties.getMail(); String captcha = RandomUtil.randomNumbers(captchaMail.getLength());