From 220941cad39f1d0e5d75c219e62ec11d9ec0799b Mon Sep 17 00:00:00 2001 From: Nico von Geyso Date: Fri, 28 Sep 2012 22:21:53 +0200 Subject: added possibility to delete service passwords --- account.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'account.py') diff --git a/account.py b/account.py index 14af184..2ef2e41 100644 --- a/account.py +++ b/account.py @@ -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 "" % 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 -- cgit v1.2.3-1-g7c22 From bb4f72750e6e537913b3cf2477879c2ab3eecc10 Mon Sep 17 00:00:00 2001 From: Nico von Geyso Date: Sat, 29 Sep 2012 01:59:44 +0200 Subject: only working services for the moment are: gitlab and osqa --- account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'account.py') diff --git a/account.py b/account.py index 2ef2e41..8adc86a 100644 --- a/account.py +++ b/account.py @@ -5,8 +5,8 @@ from uuid import uuid4 SERVICES = [ - Service('foren', 'Foren', 'http://foren.spline.de/'), - Service('jabber', 'Jabber', 'http://jabber.spline.de/'), + #Service('foren', 'Foren', 'http://foren.spline.de/'), + #Service('jabber', 'Jabber', 'http://jabber.spline.de/'), Service('gitlab', 'Gitlab', 'https://gitlab.spline.inf.fu-berlin.de/'), Service('osqa', 'OS Q&A', 'http://osqa.spline.de/'), ] -- cgit v1.2.3-1-g7c22