修改不能用手机号登录的问题

This commit is contained in:
weiweiw 2024-12-16 10:09:14 +08:00
parent d2f7924b54
commit ca5066e21e
6 changed files with 8 additions and 8 deletions

View File

@ -31,7 +31,7 @@ public class EmailOtpLoginStrategy implements LoginStrategy {
throw new ServiceException("用户不存在/密码错误");
}
passwordValidatorService.checkPhoneCaptcha(email, otp);
R<LoginUser> userResult = remoteUserService.getUserInfoByEmail(Sm4Utils.encrypt(email), SecurityConstants.INNER);
R<LoginUser> userResult = remoteUserService.getUserInfoByEmail(email, SecurityConstants.INNER);
//验证用户是否存在
passwordValidatorService.validateUserResult(email, userResult);
LoginUser userInfo = userResult.getData();

View File

@ -34,7 +34,7 @@ public class EmailPasswordLoginStrategy implements LoginStrategy {
throw new ServiceException("用户不存在/密码错误");
}
//通过手机号获取用户信息
R<LoginUser> userResult = remoteUserService.getUserInfoByEmail(Sm4Utils.encrypt(email), SecurityConstants.INNER);
R<LoginUser> userResult = remoteUserService.getUserInfoByEmail(email, SecurityConstants.INNER);
//验证用户是否存在
passwordValidatorService.validateUserResult(email, userResult);
//获取用户信息

View File

@ -33,7 +33,7 @@ public class PhoneOtpLoginStrategy implements LoginStrategy {
throw new ServiceException("用户不存在/验证码错误");
}
passwordValidatorService.checkPhoneCaptcha(phone, otp);
R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(Sm4Utils.encrypt(phone), SecurityConstants.INNER);
R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(phone, SecurityConstants.INNER);
//验证用户是否存在
passwordValidatorService.validateUserResult(phone, userResult);
LoginUser userInfo = userResult.getData();

View File

@ -36,7 +36,7 @@ public class PhonePasswordLoginStrategy implements LoginStrategy {
throw new ServiceException("用户不存在/密码错误");
}
//通过手机号获取用户信息
R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(Sm4Utils.encrypt(phone), SecurityConstants.INNER);
R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(phone, SecurityConstants.INNER);
//验证用户是否存在
passwordValidatorService.validateUserResult(phone, userResult);
//获取用户信息

View File

@ -44,7 +44,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 +53,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

@ -87,12 +87,12 @@ public class SysLoginService {
int contactType = getContactType(registerBody.getMobile());
if (contactType == 0) {
R<LoginUser> userResult = remoteUserService.getUserInfoByEmail(Sm4Utils.encrypt(registerBody.getMobile()) , SecurityConstants.INNER);
R<LoginUser> userResult = remoteUserService.getUserInfoByEmail(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);
R<LoginUser> userResult = remoteUserService.getUserInfoByPhone(registerBody.getMobile() , SecurityConstants.INNER);
if (userResult.getData() != null) {
throw new ServiceException("联系方式已经注册账号");
}