Merge pull request #3193 from dataease/pr@dev@fix_ldap_empty_email

fix(ldap): ldap用户邮箱为空无法登录DE
This commit is contained in:
xuwei-fit2cloud 2022-09-27 09:48:01 +08:00 committed by GitHub
commit e089a38cd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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();