Take uid as parameter for change_password instead of user_dn

This commit is contained in:
PCoder 2019-02-24 17:24:44 +01:00
parent 7d09819ccb
commit 3bc2e0a7e5
2 changed files with 5 additions and 5 deletions

View file

@ -121,17 +121,17 @@ class LdapManager:
conn.unbind() 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 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 :param new_password: str The new password string
:return: True if password was changed successfully False otherwise :return: True if password was changed successfully False otherwise
""" """
conn = self.get_admin_conn() conn = self.get_admin_conn()
return_val = conn.modify( return_val = conn.modify(
user_dn, ("uid={uid}," + settings.LDAP_CUSTOMER_DN).format(uid=uid),
{ {
"userpassword": ( "userpassword": (
ldap3.MODIFY_REPLACE, ldap3.MODIFY_REPLACE,

View file

@ -289,7 +289,7 @@ class ResetRequest(View):
ldap_manager = LdapManager() ldap_manager = LdapManager()
result = ldap_manager.change_password( result = ldap_manager.change_password(
("uid={uid}," + settings.LDAP_CUSTOMER_DN).format(uid=user), user,
password1 password1
) )
# password change successful # password change successful
@ -351,7 +351,7 @@ class ChangePassword(View):
from .ungleich_ldap import LdapManager from .ungleich_ldap import LdapManager
ldap_manager = LdapManager() ldap_manager = LdapManager()
result = ldap_manager.change_password( result = ldap_manager.change_password(
("uid={uid}," + settings.LDAP_CUSTOMER_DN).format(uid=user), user,
password1 password1
) )
# Password was changed # Password was changed