From 4a3e24dd6f59623bf7d8b33ff2835dd5471be5b0 Mon Sep 17 00:00:00 2001
From: Andreas <andreasv@fsmpi.rwth-aachen.de>
Date: Thu, 25 Jan 2018 18:12:26 +0100
Subject: [PATCH] catching ldap3.core.exceptions.LDAPPasswordIsMandatoryError
 if a mod login is requested without a password, closes #354

---
 ldap.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ldap.py b/ldap.py
index 0391176..5dafae0 100644
--- a/ldap.py
+++ b/ldap.py
@@ -9,7 +9,7 @@ if 'LDAP_HOST' in config:
 		user = LDAP_USERRE.sub(r'', user.lower())
 		try:
 			conn = ldap3.Connection(ldap3.Server(config['LDAP_HOST'], port=config['LDAP_PORT'], use_ssl=True), 'fsmpi\\%s'%user, password, auto_bind=True, check_names=False)
-		except ldap3.core.exceptions.LDAPBindError:
+		except ldap3.core.exceptions.LDAPBindError, ldap3.core.exceptions.LDAPPasswordIsMandatoryError:
 			return {}, []
 		conn.search("cn=users,dc=fsmpi,dc=rwth-aachen,dc=de", "(cn=%s)"%user, attributes=['memberOf', 'givenName', 'sn'])
 		info = {'uid': user, 'givenName': conn.response[0]['attributes']['givenName'][0], 'sn': conn.response[0]['attributes']['sn'][0]}
-- 
GitLab