WIP: Add ungleich_ldap and use it to reset password

This commit is contained in:
PCoder 2019-02-23 18:47:01 +01:00
commit f6f688dcb5
2 changed files with 153 additions and 5 deletions

View file

@ -342,11 +342,15 @@ class ResetRequest(View):
if len(password1) < 8:
return render(request, 'error.html', { 'service': service, 'error': 'The password is too short, please use a longer one. At least 8 characters.' } )
# everything checks out, now change the password
with get_pool().next() as rpc:
pwd = r'%s' % password1
result = rpc.changepassword.change_password(user, pwd)
# password change successfull
if result == True:
from .ungleich_ldap import LdapManager
ldap_manager = LdapManager()
result = ldap_manager.change_password(
("uid={uid}," + settings.LDAP_CUSTOMER_DN).format(uid=user),
password1
)
# password change successful
if result:
return render(request, 'changedpassword.html', { 'user': user } )
# Something went wrong while changing the password
else: