Commit 37fcc5cbe7b749c213a0c1a7981db319fb0138bf
1 parent
c29b061f
解决登录时输入无效租户名称登录失败提示不友好问题
Showing
1 changed file
with
6 additions
and
2 deletions
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/security/TenantSecurityWebFilter.java
| ... | ... | @@ -78,8 +78,12 @@ public class TenantSecurityWebFilter extends ApiRequestFilter { |
| 78 | 78 | // 2. 如果请求未带租户的编号,不允许访问。 |
| 79 | 79 | if (tenantId == null) { |
| 80 | 80 | log.error("[doFilterInternal][URL({}/{}) 未传递租户编号]", request.getRequestURI(), request.getMethod()); |
| 81 | - ServletUtils.writeJSON(response, CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST.getCode(), | |
| 82 | - "租户的请求未传递,请进行排查")); | |
| 81 | + String msg = "请求的租户标识未传递,请进行排查"; | |
| 82 | + if ("/admin-api/system/auth/login".equals(request.getRequestURI())) | |
| 83 | + { | |
| 84 | + msg = "登录失败,租户名称不正确"; | |
| 85 | + } | |
| 86 | + ServletUtils.writeJSON(response, CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST.getCode(), msg)); | |
| 83 | 87 | return; |
| 84 | 88 | } |
| 85 | 89 | // 3. 校验租户是合法,例如说被禁用、到期 | ... | ... |