fix(ldap): ldap用户邮箱为空无法登录DE

This commit is contained in:
fit2cloud-chenyw 2022-09-26 21:48:02 +08:00
parent 553584b6e5
commit 567bbe1f5a

View File

@ -47,6 +47,7 @@ import javax.servlet.http.HttpSession;
@RestController
public class AuthServer implements AuthApi {
private static final String LDAP_EMAIL_SUFFIX = "@ldap.com";
@Value("${dataease.init_password:DataEase123..}")
private String DEFAULT_PWD;
@ -83,6 +84,9 @@ public class AuthServer implements AuthApi {
DataEaseException.throwException(validateResult.getMsg());
}
XpackLdapUserEntity ldapUserEntity = validateResult.getData();
if (StringUtils.isBlank(ldapUserEntity.getEmail())) {
ldapUserEntity.setEmail(username + LDAP_EMAIL_SUFFIX);
}
SysUserEntity user = authUserService.getLdapUserByName(username);
if (ObjectUtils.isEmpty(user) || ObjectUtils.isEmpty(user.getUserId())) {
LdapAddRequest ldapAddRequest = new LdapAddRequest();