yonge 5 年之前
父节点
当前提交
28e9998504

+ 3 - 2
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/filter/PhoneLoginAuthenticationFilter.java

@@ -18,6 +18,7 @@ import org.springframework.security.web.authentication.AbstractAuthenticationPro
 import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
 
 import com.ym.mec.auth.api.dto.SysUserInfo;
+import com.ym.mec.auth.api.enums.SysUserType;
 import com.ym.mec.auth.config.constant.SecurityConstants;
 import com.ym.mec.auth.config.token.PhoneAuthenticationToken;
 import com.ym.mec.auth.service.SysUserService;
@@ -59,8 +60,8 @@ public class PhoneLoginAuthenticationFilter extends AbstractAuthenticationProces
 			throw new UsernameNotFoundException("用户名或密码错误");
 		}
 	
-		if (!StringUtils.equalsIgnoreCase(clientId, userInfo.getSysUser().getUserType().getCode())) {
-			throw new LockedException("用户名或密码错误");
+		if (userInfo.getSysUser().getUserType() != SysUserType.SYSTEM && !StringUtils.equalsIgnoreCase(clientId, userInfo.getSysUser().getUserType().getCode())) {
+			throw new LockedException("登录失败");
 		}
 
 		principal = principal.trim();

+ 3 - 2
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/filter/UsernameAuthenticationFilter.java

@@ -19,6 +19,7 @@ import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
 import org.springframework.util.Assert;
 
 import com.ym.mec.auth.api.dto.SysUserInfo;
+import com.ym.mec.auth.api.enums.SysUserType;
 import com.ym.mec.auth.config.constant.SecurityConstants;
 import com.ym.mec.auth.service.SysUserService;
 
@@ -70,8 +71,8 @@ public class UsernameAuthenticationFilter extends AbstractAuthenticationProcessi
 			throw new UsernameNotFoundException("用户名或密码错误");
 		}
 	
-		if (!StringUtils.equalsIgnoreCase(clientId, userInfo.getSysUser().getUserType().getCode())) {
-			throw new LockedException("用户名或密码错误");
+		if (userInfo.getSysUser().getUserType() != SysUserType.SYSTEM && !StringUtils.equalsIgnoreCase(clientId, userInfo.getSysUser().getUserType().getCode())) {
+			throw new LockedException("登录失败");
 		}
 
 		UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(SecurityConstants.USERNAME_PRINCIPAL_PREFIX + username,