From 731bfa065ab3a10ab933aaffd2e9ceebf0a4d16d Mon Sep 17 00:00:00 2001 From: Charles7c Date: Sat, 19 Oct 2024 14:57:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=82=AE=E7=AE=B1=E9=AA=8C=E8=AF=81=E7=A0=81=E6=9C=AA=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E8=A1=8C=E4=B8=BA=E9=AA=8C=E8=AF=81=E7=A0=81=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/common/CaptchaController.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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());