From af8d62e5e20b8a8d131bdf326b7d2304d0a96b88 Mon Sep 17 00:00:00 2001 From: PowderSnow <1109835296@qq.com> Date: Sun, 12 May 2024 19:21:59 +0000 Subject: [PATCH] =?UTF-8?q?update=20ruoyi-gateway/src/main/java/com/ruoyi/?= =?UTF-8?q?gateway/service/impl/ValidateCodeServiceImpl.java.=20=E7=9B=AE?= =?UTF-8?q?=E5=89=8D=E6=8A=A5=E2=80=9D=E9=AA=8C=E8=AF=81=E7=A0=81=E5=B7=B2?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E2=80=9C=E7=9A=84=E5=9C=BA=E6=99=AF=E6=98=AF?= =?UTF-8?q?uuid=E4=B8=BA=E7=A9=BA=EF=BC=8C=E5=BA=94=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=88=A4=E6=96=ADcaptcha=E6=98=AF=E5=90=A6=E4=B8=BAnull?= =?UTF-8?q?=E5=BE=97=E5=87=BA=E9=AA=8C=E8=AF=81=E7=A0=81=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=B7=B2=E8=BF=87=E6=9C=9F=E7=9A=84=E7=BB=93=E6=9E=9C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: PowderSnow <1109835296@qq.com> --- .../gateway/service/impl/ValidateCodeServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java index 4c130a93..bc5fc7fe 100644 --- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java @@ -105,10 +105,16 @@ public class ValidateCodeServiceImpl implements ValidateCodeService } if (StringUtils.isEmpty(uuid)) { - throw new CaptchaException("验证码已失效"); + throw new CaptchaException("uuid不能为空"); } + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; String captcha = redisService.getCacheObject(verifyKey); + if (captcha == null) + { + throw new CaptchaException("验证码已失效"); + } + redisService.deleteObject(verifyKey); if (!code.equalsIgnoreCase(captcha))