LDAP connection bugfix

This commit is contained in:
Alexis Gavoty 2013-10-26 20:41:53 +02:00
parent 4618264c86
commit 97de68996a

View file

@ -288,14 +288,15 @@ class YunoHostLDAP(Singleton):
print(_('Invalid password... Try again')) print(_('Invalid password... Try again'))
else: else:
need_password = False need_password = False
self.level = self.level+1
try: try:
self.conn.simple_bind_s('cn=admin,' + self.base, self.pwd) self.conn.simple_bind_s('cn=admin,' + self.base, self.pwd)
self.connected = True self.connected = True
except ldap.INVALID_CREDENTIALS: except ldap.INVALID_CREDENTIALS:
raise YunoHostError(13, _('Invalid credentials')) raise YunoHostError(13, _('Invalid credentials'))
self.level = self.level+1
def __exit__(self, type, value, traceback): def __exit__(self, type, value, traceback):
self.level = self.level-1 self.level = self.level-1
if self.level == 0: if self.level == 0: