diff --git a/dal/ungleich_ldap.py b/dal/ungleich_ldap.py index 5e31b38..c85ba48 100644 --- a/dal/ungleich_ldap.py +++ b/dal/ungleich_ldap.py @@ -121,17 +121,17 @@ class LdapManager: conn.unbind() - def change_password(self, user_dn, new_password): + def change_password(self, uid, new_password): """ Changes the password of the user identified by user_dn - :param user_dn: str The distinguished name for identifying the user + :param uid: str The uid that identifies the user :param new_password: str The new password string :return: True if password was changed successfully False otherwise """ conn = self.get_admin_conn() return_val = conn.modify( - user_dn, + ("uid={uid}," + settings.LDAP_CUSTOMER_DN).format(uid=uid), { "userpassword": ( ldap3.MODIFY_REPLACE, diff --git a/dal/views.py b/dal/views.py index a4e02f0..e9793b8 100644 --- a/dal/views.py +++ b/dal/views.py @@ -289,7 +289,7 @@ class ResetRequest(View): ldap_manager = LdapManager() result = ldap_manager.change_password( - ("uid={uid}," + settings.LDAP_CUSTOMER_DN).format(uid=user), + user, password1 ) # password change successful @@ -351,7 +351,7 @@ class ChangePassword(View): from .ungleich_ldap import LdapManager ldap_manager = LdapManager() result = ldap_manager.change_password( - ("uid={uid}," + settings.LDAP_CUSTOMER_DN).format(uid=user), + user, password1 ) # Password was changed