Explorar o código

【苏大漏洞】 登录账号不存在提示语统一“账号或密码错误”

linfutong %!s(int64=3) %!d(string=hai) anos
pai
achega
ce60351ffc

+ 1 - 1
zd-auth/src/main/java/com/zd/auth/controller/TokenController.java

@@ -170,7 +170,7 @@ public class TokenController {
         String username = form.getUsername();
         R<LoginUser> userR = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
         if (userR.getCode() != HttpStatus.SUCCESS || userR.getData() == null) {
-            throw new ServiceException("登录用户:" + username + " 不存在", 530);
+            throw new ServiceException("用户不存在", 530);
         }
         String key = BaseConstants.DEFAULT_CODE_KEY + BaseConstants.GRANT_TYPE_MOBILE + "@" + username;
         String code = RandomUtil.randomNumbers(6);

+ 2 - 2
zd-auth/src/main/java/com/zd/auth/service/SysLoginService.java

@@ -65,7 +65,7 @@ public class SysLoginService {
         }
         if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
 //            recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
-            throw new ServiceException("登录用户:" + username + " 不存在", 530);
+            throw new ServiceException("账号或密码错误", 530);
         }
         LoginUser userInfo = userResult.getData();
         SysUser user = userResult.getData().getSysUser();
@@ -79,7 +79,7 @@ public class SysLoginService {
         }
         if (!SecurityUtils.matchesPassword(password, user.getPassword())) {
 //            recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码错误");
-            throw new ServiceException("用户不存在/密码错误", 530);
+            throw new ServiceException("账号或密码错误", 530);
         }
         recordLogininfor(user, BaseConstants.LOGIN_SUCCESS, "登录成功");
         return userInfo;

+ 0 - 15
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/LoginService.java

@@ -1,6 +1,5 @@
 package com.zd.alg.forward.serivce;
 
-import com.alibaba.fastjson.JSON;
 import com.zd.alg.forward.config.AlgorithmYml;
 import com.zd.auth.feign.RemoteAuthService;
 import com.zd.auth.form.LoginBody;
@@ -10,19 +9,12 @@ import com.zd.model.constant.SecurityConstants;
 import com.zd.model.domain.R;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.ParameterizedTypeReference;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.util.Assert;
 import org.springframework.web.client.RestClientException;
-import org.springframework.web.client.RestTemplate;
-
 import javax.annotation.Resource;
-import java.util.HashMap;
 import java.util.Map;
 
 @Service
@@ -68,12 +60,6 @@ public class LoginService {
         }
     }
 
-
-    public String getCacheToken() {
-        //换取缓存的token
-        return getToken();
-    }
-
     /**
      * 刷新key
      */
@@ -98,5 +84,4 @@ public class LoginService {
             refreshToken();
         }
     }
-
 }