diff options
author | Nico von Geyso <Nico.Geyso@FU-Berlin.de> | 2012-09-28 22:21:53 +0200 |
---|---|---|
committer | Nico von Geyso <Nico.Geyso@FU-Berlin.de> | 2012-09-28 22:21:53 +0200 |
commit | 220941cad39f1d0e5d75c219e62ec11d9ec0799b (patch) | |
tree | 6009043a2bf9f2a07a47dba2bbb2faaec4e58980 /account.py | |
parent | ee35835b75119e57dd23f13fba95c02e50125a44 (diff) | |
download | web-220941cad39f1d0e5d75c219e62ec11d9ec0799b.tar.gz web-220941cad39f1d0e5d75c219e62ec11d9ec0799b.tar.bz2 web-220941cad39f1d0e5d75c219e62ec11d9ec0799b.zip |
added possibility to delete service passwords
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 |