diff options
Diffstat (limited to 'account.py')
-rw-r--r-- | account.py | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -276,16 +276,23 @@ class AccountService: for service, passwords in account.new_password_services.items(): dn = self._format_dn([('uid',account.uid),('cn',service),('ou','services')]) + old, new = passwords - if service not in account.services: - attr = [('objectClass', ['top', 'servicePassword']), ('uid', account.uid)] - self.connection.add_s(dn, attr) + if new != None: + if service not in account.services: + attr = [('objectClass', ['top', 'servicePassword']), ('uid', account.uid)] + self.connection.add_s(dn, attr) + + if as_admin: + self.connection.passwd_s(dn, None, new) + else: + self.connection.passwd_s(dn, old, new) - old, new = passwords - if as_admin: - self.connection.passwd_s(dn, None, new) else: - self.connection.passwd_s(dn, old, new) + s = service.lower() + if s in account.services: + self.connection.delete_s(dn) + account.services.remove(s) account.new_password_services = {} @@ -321,6 +328,9 @@ class Account: return "<Account uid=%s>" % self.uid + def reset_password(self, service): + self.new_password_services[service] = (None, None) + def change_password(self, new_password, old_password='', service=None): """ Changes a password for a given service. You have to use the |