Skip to content

Commit

Permalink
MGR-144
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Müller authored and Matthias Müller committed Sep 21, 2022
1 parent 8d9f0bb commit 0ad1f98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion application-home/dictionary/manager-messages.properties
Expand Up @@ -135,7 +135,8 @@ lastLogin=Last login
lastUpdated=Last updated
latestRelease=Latest release
latestSnapshot=Latest snapshot
ldap.disabled=LDAP Authentication is disabled. Set site property ''{0}'' to ''false'' to enable.
ldap.disabled=LDAP Authentication is disabled via site property ''{0}''.
ldap.noAdminPassword=No password for LDAP admin user ''{0}'' is set. Use site property ''{1}'' to set one.
ldap.users=LDAP Users
ldap.settings=LDAP Settings
ldap.not.working=Unable to connect to LDAP server at {0}, please check configuration!
Expand Down
Expand Up @@ -76,10 +76,16 @@ public DataContainer getData(Site site, Application application, Environment env
dataContainer.setItems(ldapProps);

if (!ldapDisabled) {
char[] ldapPw = siteProps.getString(LdapService.LDAP_PASSWORD, StringUtils.EMPTY).toCharArray();
boolean adminLoginOk = ldapService.loginUser(site, ldapUser.getString(), ldapPw);
if (!adminLoginOk) {
fp.addErrorMessage(request.getMessage(MessageConstants.LDAP_NOT_WORKING, ldapHost.getString()));
String ldapPassword = siteProps.getString(LdapService.LDAP_PASSWORD, StringUtils.EMPTY);
if (StringUtils.isNotBlank(ldapPassword)) {
char[] ldapPw = ldapPassword.toCharArray();
boolean adminLoginOk = ldapService.loginUser(site, ldapUser.getString(), ldapPw);
if (!adminLoginOk) {
fp.addErrorMessage(request.getMessage(MessageConstants.LDAP_NOT_WORKING, ldapHost.getString()));
}
} else {
fp.addNoticeMessage(request.getMessage(MessageConstants.LDAP_NO_ADMIN_PASSWORD,
ldapUser.getString(), LdapService.LDAP_PASSWORD));
}
}
} else {
Expand Down

0 comments on commit 0ad1f98

Please sign in to comment.