Fix the empty-query test in autocomplete

If there is no valid word to search in the LDAP database, no query is
performed. Since 74f0b63e, that behaviour was broken because of a typo
This commit is contained in:
Martin Pépin 2017-03-20 08:14:20 +00:00
parent 74f0b63e96
commit 0aed975615
2 changed files with 2 additions and 2 deletions

View file

@ -60,7 +60,7 @@ def autocomplete(request):
'(|(cn=*{bit:s}*)(uid=*{bit:s}*))'.format(bit=bit)
for bit in bits if bit.isalnum()
))
if ldap_query != "(|)":
if ldap_query != "(&)":
# If none of the bits were legal, we do not perform the query
with Connection(settings.LDAP_SERVER_URL) as conn:
conn.search(

View file

@ -79,7 +79,7 @@ def account_create(request):
'(|(cn=*{bit:s}*)(uid=*{bit:s}*))'.format(bit=word)
for word in search_words if word.isalnum()
))
if ldap_query != "(|)":
if ldap_query != "(&)":
# If none of the bits were legal, we do not perform the query
with Connection(settings.LDAP_SERVER_URL) as conn:
conn.search(