解决登录时输入无效租户名称登录失败提示不友好问题

This commit is contained in:
shizhong 2023-03-29 21:14:05 +08:00
parent c29b061f4c
commit 37fcc5cbe7
1 changed files with 6 additions and 2 deletions

View File

@ -78,8 +78,12 @@ public class TenantSecurityWebFilter extends ApiRequestFilter {
// 2. 如果请求未带租户的编号不允许访问
if (tenantId == null) {
log.error("[doFilterInternal][URL({}/{}) 未传递租户编号]", request.getRequestURI(), request.getMethod());
ServletUtils.writeJSON(response, CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST.getCode(),
"租户的请求未传递,请进行排查"));
String msg = "请求的租户标识未传递,请进行排查";
if ("/admin-api/system/auth/login".equals(request.getRequestURI()))
{
msg = "登录失败,租户名称不正确";
}
ServletUtils.writeJSON(response, CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST.getCode(), msg));
return;
}
// 3. 校验租户是合法例如说被禁用到期