forked from github/dataease
Merge pull request #3193 from dataease/pr@dev@fix_ldap_empty_email
fix(ldap): ldap用户邮箱为空无法登录DE
This commit is contained in:
commit
e089a38cd9
@ -47,6 +47,7 @@ import javax.servlet.http.HttpSession;
|
|||||||
@RestController
|
@RestController
|
||||||
public class AuthServer implements AuthApi {
|
public class AuthServer implements AuthApi {
|
||||||
|
|
||||||
|
private static final String LDAP_EMAIL_SUFFIX = "@ldap.com";
|
||||||
@Value("${dataease.init_password:DataEase123..}")
|
@Value("${dataease.init_password:DataEase123..}")
|
||||||
private String DEFAULT_PWD;
|
private String DEFAULT_PWD;
|
||||||
|
|
||||||
@ -83,6 +84,9 @@ public class AuthServer implements AuthApi {
|
|||||||
DataEaseException.throwException(validateResult.getMsg());
|
DataEaseException.throwException(validateResult.getMsg());
|
||||||
}
|
}
|
||||||
XpackLdapUserEntity ldapUserEntity = validateResult.getData();
|
XpackLdapUserEntity ldapUserEntity = validateResult.getData();
|
||||||
|
if (StringUtils.isBlank(ldapUserEntity.getEmail())) {
|
||||||
|
ldapUserEntity.setEmail(username + LDAP_EMAIL_SUFFIX);
|
||||||
|
}
|
||||||
SysUserEntity user = authUserService.getLdapUserByName(username);
|
SysUserEntity user = authUserService.getLdapUserByName(username);
|
||||||
if (ObjectUtils.isEmpty(user) || ObjectUtils.isEmpty(user.getUserId())) {
|
if (ObjectUtils.isEmpty(user) || ObjectUtils.isEmpty(user.getUserId())) {
|
||||||
LdapAddRequest ldapAddRequest = new LdapAddRequest();
|
LdapAddRequest ldapAddRequest = new LdapAddRequest();
|
||||||
|
Loading…
Reference in New Issue
Block a user