浏览代码

!368 未合理判断验证码失效
Merge pull request !368 from PowderSnow/N/A

若依 1 年之前
父节点
当前提交
1a3751ab71

+ 7 - 1
ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java

@@ -105,10 +105,16 @@ public class ValidateCodeServiceImpl implements ValidateCodeService
105 105
         }
106 106
         if (StringUtils.isEmpty(uuid))
107 107
         {
108
-            throw new CaptchaException("验证码已失效");
108
+            throw new CaptchaException("uuid不能为空");
109 109
         }
110
+        
110 111
         String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
111 112
         String captcha = redisService.getCacheObject(verifyKey);
113
+        if (captcha == null)
114
+        {
115
+            throw new CaptchaException("验证码已失效");
116
+        }
117
+
112 118
         redisService.deleteObject(verifyKey);
113 119
 
114 120
         if (!code.equalsIgnoreCase(captcha))