fix 修复 关闭租户功能 三方登录报错问题
This commit is contained in:
parent
f5420f1f07
commit
f72ce39c13
@ -7,7 +7,6 @@ import cn.hutool.core.map.MapUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.http.Method;
|
import cn.hutool.http.Method;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import me.zhyd.oauth.model.AuthResponse;
|
import me.zhyd.oauth.model.AuthResponse;
|
||||||
@ -23,8 +22,6 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
|||||||
import org.dromara.common.social.config.properties.SocialProperties;
|
import org.dromara.common.social.config.properties.SocialProperties;
|
||||||
import org.dromara.common.social.utils.SocialUtils;
|
import org.dromara.common.social.utils.SocialUtils;
|
||||||
import org.dromara.common.tenant.helper.TenantHelper;
|
import org.dromara.common.tenant.helper.TenantHelper;
|
||||||
import org.dromara.system.domain.SysClient;
|
|
||||||
import org.dromara.system.domain.SysUser;
|
|
||||||
import org.dromara.system.domain.vo.SysClientVo;
|
import org.dromara.system.domain.vo.SysClientVo;
|
||||||
import org.dromara.system.domain.vo.SysSocialVo;
|
import org.dromara.system.domain.vo.SysSocialVo;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
@ -84,11 +81,16 @@ public class SocialAuthStrategy implements IAuthStrategy {
|
|||||||
if (CollUtil.isEmpty(list)) {
|
if (CollUtil.isEmpty(list)) {
|
||||||
throw new ServiceException("你还没有绑定第三方账号,绑定后才可以登录!");
|
throw new ServiceException("你还没有绑定第三方账号,绑定后才可以登录!");
|
||||||
}
|
}
|
||||||
|
SysSocialVo social;
|
||||||
|
if (TenantHelper.isEnable()) {
|
||||||
Optional<SysSocialVo> opt = list.stream().filter(x -> x.getTenantId().equals(loginBody.getTenantId())).findAny();
|
Optional<SysSocialVo> opt = list.stream().filter(x -> x.getTenantId().equals(loginBody.getTenantId())).findAny();
|
||||||
if (opt.isEmpty()) {
|
if (opt.isEmpty()) {
|
||||||
throw new ServiceException("对不起,你没有权限登录当前租户!");
|
throw new ServiceException("对不起,你没有权限登录当前租户!");
|
||||||
}
|
}
|
||||||
SysSocialVo social = opt.get();
|
social = opt.get();
|
||||||
|
} else {
|
||||||
|
social = list.get(0);
|
||||||
|
}
|
||||||
// 查找用户
|
// 查找用户
|
||||||
SysUserVo user = loadUser(social.getTenantId(), social.getUserId());
|
SysUserVo user = loadUser(social.getTenantId(), social.getUserId());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user