mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-02 18:46:13 +00:00
fix 修复 用户注册接口校验用户名不区分租户问题
This commit is contained in:
@@ -57,14 +57,6 @@ public interface RemoteUserService {
|
||||
*/
|
||||
XcxLoginUser getUserInfoByOpenid(String openid) throws UserException;
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param remoteUserBo 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
boolean checkUserNameUnique(RemoteUserBo remoteUserBo);
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
|
@@ -136,10 +136,7 @@ public class SysLoginService {
|
||||
remoteUserBo.setNickName(username);
|
||||
remoteUserBo.setPassword(BCrypt.hashpw(password));
|
||||
remoteUserBo.setUserType(userType);
|
||||
// 校验用户名是否唯一
|
||||
if (!remoteUserService.checkUserNameUnique(remoteUserBo)) {
|
||||
throw new UserException("user.register.save.error", username);
|
||||
}
|
||||
|
||||
boolean regFlag = remoteUserService.registerUserInfo(remoteUserBo);
|
||||
if (!regFlag) {
|
||||
throw new UserException("user.register.error");
|
||||
|
@@ -143,11 +143,6 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
return loginUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkUserNameUnique(RemoteUserBo remoteUserBo) {
|
||||
return userService.checkUserNameUnique(MapstructUtils.convert(remoteUserBo, SysUserBo.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean registerUserInfo(RemoteUserBo remoteUserBo) throws UserException, ServiceException {
|
||||
SysUserBo sysUserBo = MapstructUtils.convert(remoteUserBo, SysUserBo.class);
|
||||
@@ -155,7 +150,11 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
||||
throw new ServiceException("当前系统没有开启注册功能");
|
||||
}
|
||||
if (!userService.checkUserNameUnique(sysUserBo)) {
|
||||
boolean exist = userMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||
.eq(TenantHelper.isEnable(), SysUser::getTenantId, remoteUserBo.getTenantId())
|
||||
.eq(SysUser::getUserName, sysUserBo.getUserName())
|
||||
.ne(ObjectUtil.isNotNull(sysUserBo.getUserId()), SysUser::getUserId, sysUserBo.getUserId()));
|
||||
if (exist) {
|
||||
throw new UserException("user.register.save.error", username);
|
||||
}
|
||||
return userService.registerUser(sysUserBo, remoteUserBo.getTenantId());
|
||||
|
Reference in New Issue
Block a user