diff options
-rw-r--r-- | account.py | 7 | ||||
-rw-r--r-- | app.py | 5 |
2 files changed, 8 insertions, 4 deletions
@@ -84,7 +84,7 @@ class AccountService: dn = self._format_dn([('ou', 'services')]) filterstr = '(uid=%s)' % self._escape(uid) - data_service = self.connection.search_s(dn,ldap.SCOPE_SUBTREE,filterstr) + data_service = self.connection.search_s(dn, ldap.SCOPE_SUBTREE, filterstr) services = [] for entry in data_service: @@ -269,6 +269,11 @@ class AccountService: for service, passwords in account.new_password_services.items(): dn = self._format_dn([('uid',account.uid),('cn',service),('ou','services')]) + + if service not in account.services: + attr = [('objectClass', ['top', 'servicePassword']), ('uid', account.uid)] + self.connection.add_s(dn, attr) + old, new = passwords if as_admin: self.connection.passwd_s(dn, None, new) @@ -204,11 +204,10 @@ def settings(): field = form.get_servicepassword(service.id) if field.data: changed = True - g.user.change_password(field.data, session['password'], service.id) - + g.user.change_password(field.data, None, service.id) if changed: - g.ldap.update(g.user) + g.ldap.update(g.user, as_admin=True) #XXX: as_admin wieder wegmachen sobald ACLs richtig gesetzt sind return redirect(url_for('settings')) else: flash(u'Nichts geƤndert.') |