Take uid as parameter for change_password instead of user_dn
This commit is contained in:
parent
7d09819ccb
commit
3bc2e0a7e5
2 changed files with 5 additions and 5 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue