mitao
2025-01-20 2b79f2033d7606eb9fb449af39ae3c41145edecd
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java
@@ -183,7 +183,10 @@
                throw new CaptchaException("验证码错误");
            }
        }
        remoteCompanyUserService.registerUser(registerUser, SecurityConstants.INNER);
        R<Boolean> booleanR = remoteCompanyUserService.registerUser(registerUser, SecurityConstants.INNER);
        if (R.isError(booleanR)){
            throw new ServiceException("注册失败");
        }
    }
@@ -192,6 +195,19 @@
        String accountName = registerUser.getAccountName();
        String password = registerUser.getPassword();
        R<User> userByPhoneR = remoteCompanyUserService.getUserByPhone(accountName, SecurityConstants.INNER);
        if (R.isError(userByPhoneR)){
            throw new ServiceException(userByPhoneR.getMsg());
        }
        if (userByPhoneR.getData() == null){
            throw new ServiceException("账号不存在");
        }
        if (SecurityUtils.matchesPassword(password, userByPhoneR.getData().getPassword())){
            return userByPhoneR.getData();
        }
        R<User> r = remoteCompanyUserService.getUserByAccountName(accountName, SecurityConstants.INNER);
        if (R.isError(r)){
            throw new ServiceException(r.getMsg());
@@ -199,7 +215,7 @@
        if (r.getData() == null){
            throw new ServiceException("账号不存在");
        }
        if (!SecurityUtils.matchesPassword(r.getData().getPassword(), password)){
        if (!SecurityUtils.matchesPassword(password, r.getData().getPassword())){
            throw new ServiceException("密码错误");
        }
        return r.getData();