diff --git a/backend/src/main/java/io/dataease/auth/server/AuthServer.java b/backend/src/main/java/io/dataease/auth/server/AuthServer.java index 9bea8f4a0e..6a400910be 100644 --- a/backend/src/main/java/io/dataease/auth/server/AuthServer.java +++ b/backend/src/main/java/io/dataease/auth/server/AuthServer.java @@ -91,6 +91,11 @@ public class AuthServer implements AuthApi { SysUserEntity user = authUserService.getUserByName(username); + // 验证登录类型是否与用户类型相同 + if (!sysUserService.validateLoginType(user.getFrom(), loginType)) { + DataEaseException.throwException(Translator.get("i18n_id_or_pwd_error")); + } + if (ObjectUtils.isEmpty(user)) { DataEaseException.throwException(Translator.get("i18n_id_or_pwd_error")); } diff --git a/backend/src/main/java/io/dataease/service/sys/SysUserService.java b/backend/src/main/java/io/dataease/service/sys/SysUserService.java index 2d77f5fb85..6038834457 100644 --- a/backend/src/main/java/io/dataease/service/sys/SysUserService.java +++ b/backend/src/main/java/io/dataease/service/sys/SysUserService.java @@ -156,6 +156,11 @@ public class SysUserService { }); } + public boolean validateLoginType(Integer from, Integer loginType) { + + return ObjectUtils.isNotEmpty(from) && ObjectUtils.isNotEmpty(loginType) && from == loginType; + } + public List ldapUserNames() { List usernames = extSysUserMapper.ldapUserNames(1);