瀏覽代碼

返回前端错误码整理

chenyongxing 5 年之前
父節點
當前提交
dc9f49b824

+ 1 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/ResultStatus.java

@ -13,7 +13,7 @@ public class ResultStatus {
     */
    public static final Integer ERROR_TOKEN = 1100; //token有误,错误的token  或者 过期的token
    public static final Integer NULL_TOKEN = 1101;// token为空
    public static final Integer INVALID_GRANT = 1102; //授权失败,看具体报错信息,如验证码错误,密码错误等
    public static final Integer INVALID_GRANT = 1102; //授权失败,看具体报错信息,如验证码错误,密码错误等,  [登陆时候,用户不存在/应用不存在,归位此类,方便前端判断]
    public static final Integer NO_PERMI = 1103; //无权限访问

+ 2 - 2
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/WlyyTokenGranter.java

@ -315,9 +315,9 @@ public class WlyyTokenGranter implements TokenGranter {
            String username = parameters.get("username");
            String captcha = parameters.get("captcha");
                //todo cyx  部署应取消注释(自测试,可注释,不验证短信直接登录)
           if (!wlyyRedisVerifyCodeService.verification(client_id, username, captcha)){
           /*if (!wlyyRedisVerifyCodeService.verification(client_id, username, captcha)){
                throw new InvalidGrantException("Invalid captcha");
            }
            }*/
            SaltUser userDetails = (SaltUser)userDetailsService.loadUserByUsername(username);
            if (!userDetails.isEnabled()) {

+ 3 - 3
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -555,10 +555,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    public ResponseEntity<Oauth2Envelop> handleException(Exception e) throws Exception {
        LOG.debug(e.getMessage(), e);
        if (e instanceof UsernameNotFoundException) {
            return handleOAuth2Exception(new Oauth2Envelop("用户不存在!", ResultStatus.USER_NO_EXIST), e);
            return handleOAuth2Exception(new Oauth2Envelop("用户不存在!", ResultStatus.INVALID_GRANT), e);
        } else if (e instanceof NoSuchClientException) {
            return handleOAuth2Exception(new Oauth2Envelop("应用未注册!", ResultStatus.APP_NO_EXIST), e);
        } else if (e instanceof InvalidGrantException) {
            return handleOAuth2Exception(new Oauth2Envelop("应用未注册!", ResultStatus.INVALID_GRANT), e);
        } else if (e instanceof InvalidGrantException || e instanceof UsernameNotFoundException) {
            return handleOAuth2Exception(new Oauth2Envelop(invalidGrantMessage((InvalidGrantException)e), ResultStatus.INVALID_GRANT), e);
        } else if (e instanceof InvalidTokenException) {
            return handleOAuth2Exception(new Oauth2Envelop("Token有误/过期!", ResultStatus.ERROR_TOKEN), e);