Sfoglia il codice sorgente

验证码跟随session

lyhzzz 1 anno fa
parent
commit
c091679f3b

+ 3 - 0
README.md

@@ -16,6 +16,9 @@ sql
 内置有创库语句,直接执行就好
 4dkankan_v4-init.sql
 fd_fusion_xj-init.sql
+
+测试接口:
+/fusion-ucenter/notAuth/getLoginAuthCode
 ~~~~
 
 ###**v1.1.0**

+ 2 - 2
src/main/java/com/fdkankan/fusion/controller/LoginController.java

@@ -50,8 +50,8 @@ public class LoginController extends BaseController{
                 || StringUtils.isBlank(param.getCode()) || StringUtils.isBlank(param.getDeptId())){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-        //String id = request.getSession().getId();
-        String id = param.getCode();
+        String id = request.getSession().getId();
+        //String id = param.getCode();
         if(!redisUtil.hasKey(String.format(RedisKeyUtil.loginAuthCode,id))){
             throw new BusinessException(ResultCode.LOGIN_AUTH_NOT_EXIST);
         }

+ 1 - 1
src/main/java/com/fdkankan/fusion/controller/NoLoginController.java

@@ -53,7 +53,7 @@ public class NoLoginController {
             LineCaptcha lineCaptcha = new LineCaptcha(200, 100);
             RandomGenerator mathGenerator = new RandomGenerator("1234567890",4);
             lineCaptcha.setGenerator(mathGenerator);
-            redisUtil.set(String.format(RedisKeyUtil.loginAuthCode,lineCaptcha.getCode()),lineCaptcha.getCode(),60*5);
+            redisUtil.set(String.format(RedisKeyUtil.loginAuthCode,id),lineCaptcha.getCode(),60*5);
             lineCaptcha.write(response.getOutputStream());
             response.getOutputStream().close();
         } catch (Exception e){