Commit ad2ae79fe390ed1fdb0ffecddff79f54d31e3645

Authored by lifeontrip
1 parent 3cdd2e1a

fix(DEFECT-676): 修改账号锁定的提示信息

... ... @@ -42,6 +42,7 @@ import org.thingsboard.server.common.data.exception.ThingsboardErrorCode;
42 42 import org.thingsboard.server.common.data.exception.ThingsboardException;
43 43 import org.thingsboard.server.common.data.yunteng.core.Result;
44 44 import org.thingsboard.server.common.data.yunteng.core.exception.ThingsKitException;
  45 +import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage;
45 46 import org.thingsboard.server.common.msg.tools.TbRateLimitsException;
46 47 import org.thingsboard.server.dao.exception.DataValidationException;
47 48 import org.thingsboard.server.service.security.exception.AuthMethodNotSupportedException;
... ... @@ -199,7 +200,7 @@ public class ThingsboardErrorResponseHandler extends ResponseEntityExceptionHand
199 200 } else if (authenticationException instanceof DisabledException) {
200 201 mapper.writeValue(response.getWriter(), ThingsboardErrorResponse.of("User account is not active", ThingsboardErrorCode.AUTHENTICATION, HttpStatus.UNAUTHORIZED));
201 202 } else if (authenticationException instanceof LockedException) {
202   - mapper.writeValue(response.getWriter(), ThingsboardErrorResponse.of("User account is locked due to security policy", ThingsboardErrorCode.AUTHENTICATION, HttpStatus.UNAUTHORIZED));
  203 + mapper.writeValue(response.getWriter(), ThingsboardErrorResponse.of(ErrorMessage.ACCOUNT_LOCKED.getMessage(), ThingsboardErrorCode.AUTHENTICATION, HttpStatus.UNAUTHORIZED));
203 204 } else if (authenticationException instanceof JwtExpiredTokenException) {
204 205 mapper.writeValue(response.getWriter(), ThingsboardErrorResponse.of("Token has expired", ThingsboardErrorCode.JWT_TOKEN_EXPIRED, HttpStatus.UNAUTHORIZED));
205 206 } else if (authenticationException instanceof AuthMethodNotSupportedException) {
... ...
... ... @@ -11,6 +11,7 @@ public enum ErrorMessage {
11 11 ACCOUNT_DISABLED(403002, "账号已禁用"),
12 12 ACCESS_DENIED(403003, "拒绝访问"),
13 13 AUTHENTICATION_METHOD_NOT_SUPPORTED(403004, "authentication method not supported"),
  14 + ACCOUNT_LOCKED(403002, "根据相关安全策略账号已锁定!"),
14 15 USERNAME_PASSWORD_INCORRECT(401001, "incorrect username or password"),
15 16 TOKEN_EXPIRED(401002, "token has expired"),
16 17 NONE_TENANT_ASSET(401003, "not current tenant asset"),
... ...