Compare commits

..

No commits in common. "1c3012232d08c8eff3e5cca6d13959798516c466" and "e7f4c234bddbeb63afc2efa6bc8fa6fec849c50d" have entirely different histories.

2 changed files with 2 additions and 21 deletions

View File

@ -3,7 +3,6 @@ package com.bonus.auth.service;
import com.bonus.common.core.constant.SecurityConstants;
import com.bonus.common.core.domain.R;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.encryption.Sm4Utils;
import com.bonus.common.security.service.EmailService;
import com.bonus.common.security.service.SmsService;
import com.bonus.config.SystemConfig;
@ -44,7 +43,7 @@ public class RegisterVerificationCodeSender implements VerificationCodeStrategy
if (!systemConfig.getRegistersConfig().isEmailRegisters()) {
throw new ServiceException("请输入正确的联系方式");
}
R<LoginUser> userResult = remoteUserService.getUserInfoByEmail(Sm4Utils.encrypt(contactInfo) , SecurityConstants.INNER);
R<LoginUser> userResult = remoteUserService.getUserInfoByEmail(contactInfo, SecurityConstants.INNER);
if (userResult.getData() != null) {
throw new ServiceException("联系方式已经注册账号");
}
@ -53,7 +52,7 @@ public class RegisterVerificationCodeSender implements VerificationCodeStrategy
if (!systemConfig.getRegistersConfig().isPhoneRegisters()) {
throw new ServiceException("请输入正确的联系方式");
}
R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(Sm4Utils.encrypt(contactInfo), SecurityConstants.INNER);
R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(contactInfo, SecurityConstants.INNER);
if (userResult.getData() != null) {
throw new ServiceException("联系方式已经注册账号");
}

View File

@ -9,13 +9,11 @@ import com.bonus.common.core.constant.UserConstants;
import com.bonus.common.core.domain.R;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.utils.encryption.Sm4Utils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.config.SystemConfig;
import com.bonus.system.api.RemoteUserService;
import com.bonus.system.api.domain.SysUser;
import com.bonus.system.api.model.LoginUser;
import com.hankcs.hanlp.HanLP;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -84,21 +82,6 @@ public class SysLoginService {
public void register(RegisterBody registerBody) {
long startTime = System.currentTimeMillis(); // 记录开始时间
String result = convertAndAppend(registerBody.getNickName(), registerBody.getMobile());
int contactType = getContactType(registerBody.getMobile());
if (contactType == 0) {
R<LoginUser> userResult = remoteUserService.getUserInfoByEmail(Sm4Utils.encrypt(registerBody.getMobile()) , SecurityConstants.INNER);
if (userResult.getData() != null) {
throw new ServiceException("联系方式已经注册账号");
}
} else if (contactType == 1) {
R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(Sm4Utils.encrypt(registerBody.getMobile()) , SecurityConstants.INNER);
if (userResult.getData() != null) {
throw new ServiceException("联系方式已经注册账号");
}
}else {
throw new ServiceException("请输入正确的联系方式");
}
registerBody.setUsername(result);
if (StringUtils.isAnyBlank(registerBody.getUsername(), registerBody.getPassword()) ||
registerBody.getUsername().length() < UserConstants.USERNAME_MIN_LENGTH ||
@ -110,7 +93,6 @@ public class SysLoginService {
passwordValidatorService.checkPhoneCaptcha(registerBody.getMobile(),registerBody.getVerificationCode());
}
AjaxResult ajaxResult = passwordValidatorService.validatePassword(registerBody.getUsername(), registerBody.getPassword());
if (ajaxResult.isError()) {
throw new ServiceException((String) ajaxResult.get("msg"));
}