From 3bc2e0a7e519b88813dbef2c173ca1e530cd2417 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 24 Feb 2019 17:24:44 +0100 Subject: [PATCH] Take uid as parameter for change_password instead of user_dn --- dal/ungleich_ldap.py | 6 +++--- dal/views.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) 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