Skip to content
Snippets Groups Projects
Commit f3984d59 authored by srosse's avatar srosse
Browse files

OO-1453: better handling of unexpected exceptions

parent c54c64de
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ public interface LDAPLoginManager {
public Attributes bindUser(String uid, String pwd, LDAPError errors);
public void changePassword(Identity identity, String pwd, LDAPError errors);
public boolean changePassword(Identity identity, String pwd, LDAPError errors);
public Identity createAndPersistUser(Attributes userAttributes);
......
......@@ -277,13 +277,12 @@ public class LDAPLoginManagerImpl implements LDAPLoginManager, GenericEventListe
}
}
/**
* Change the password on the LDAP server.
* @see org.olat.ldap.LDAPLoginManager#changePassword(org.olat.core.id.Identity, java.lang.String, org.olat.ldap.LDAPError)
*/
@Override
public void changePassword(Identity identity, String pwd, LDAPError errors) {
public boolean changePassword(Identity identity, String pwd, LDAPError errors) {
String uid = identity.getName();
String ldapUserPasswordAttribute = syncConfiguration.getLdapUserPasswordAttribute();
try {
......@@ -310,15 +309,18 @@ public class LDAPLoginManagerImpl implements LDAPLoginManager, GenericEventListe
modificationItems [ 0 ] = new ModificationItem ( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute );
ctx.modifyAttributes ( dn, modificationItems );
ctx.close();
return true;
} catch (NamingException e) {
log.error("NamingException when trying to change password with username::" + uid, e);
errors.insert("Cannot change the password");
return false;
} catch(Exception e) {
log.error("Unexpected exception when trying to change password with username::" + uid, e);
errors.insert("Cannot change the password");
return false;
}
}
/**
* Delete all Identities in List and removes them from LDAPSecurityGroup
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment