diff --git a/ldap.py b/ldap.py index ef5430e152b039b3ab5ebc5ed0305a7411065d5a..47a079ee877798942a8564120f3607976eff64f5 100644 --- a/ldap.py +++ b/ldap.py @@ -7,9 +7,9 @@ if 'LDAP_HOST' in config: import ldap3 def ldapauth(user, password): # pylint: disable=function-redefined - if(LDAP_USERRE.search(user)): + if LDAP_USERRE.search(user): return {}, [] - try: + try: server = ldap3.Server(config['LDAP_HOST'], port=config['LDAP_PORT'], use_ssl=True) conn = ldap3.Connection(server, 'fsmpi\\%s'%user, password, auto_bind=True, check_names=False) except (ldap3.core.exceptions.LDAPBindError, ldap3.core.exceptions.LDAPPasswordIsMandatoryError): @@ -27,7 +27,7 @@ else: } def ldapauth(user, password): # pylint: disable=function-redefined - if(LDAP_USERRE.search(user)): + if LDAP_USERRE.search(user): return {}, [] if config.get('DEBUG') and user in NOTLDAP and password == NOTLDAP[user][0]: return NOTLDAP[user][2], NOTLDAP[user][1]