summaryrefslogtreecommitdiffstats
path: root/account.py
diff options
context:
space:
mode:
authorMarian Sigler <m@qjym.de>2012-09-29 15:12:18 +0200
committerMarian Sigler <m@qjym.de>2012-09-29 15:12:18 +0200
commit12a6678d280733bd420923b49608d62f8f920ab1 (patch)
tree057cb7f98d60600373f8056f597199140d836397 /account.py
parentfaa5a67b30bcedaf67223d1905036bff806cbf45 (diff)
parentf6b2d051966a232c6227a31e9851fce031d6b9f6 (diff)
downloadweb-12a6678d280733bd420923b49608d62f8f920ab1.tar.gz
web-12a6678d280733bd420923b49608d62f8f920ab1.tar.bz2
web-12a6678d280733bd420923b49608d62f8f920ab1.zip
Merge branch 'master' of ssh://git.spline.de/account-web
Diffstat (limited to 'account.py')
-rw-r--r--account.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/account.py b/account.py
index 14af184..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/'),
]
@@ -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