Change ldap query behaviour if multiple inputs

It is now consistent with the other lookups over the User database
This commit is contained in:
Martin Pépin 2017-03-19 15:06:41 +00:00
parent dc50a23b10
commit 74f0b63e96
2 changed files with 4 additions and 4 deletions

View file

@ -56,8 +56,8 @@ def autocomplete(request):
# Fetching data from the SPI
if hasattr(settings, 'LDAP_SERVER_URL'):
# Fetching
ldap_query = '(|{:s})'.format(''.join(
'(cn=*{bit:s}*)(uid=*{bit:s}*)'.format(bit=bit)
ldap_query = '(&{:s})'.format(''.join(
'(|(cn=*{bit:s}*)(uid=*{bit:s}*))'.format(bit=bit)
for bit in bits if bit.isalnum()
))
if ldap_query != "(|)":

View file

@ -75,8 +75,8 @@ def account_create(request):
# Fetching data from the SPI
if hasattr(settings, 'LDAP_SERVER_URL'):
# Fetching
ldap_query = '(|{:s})'.format(''.join(
'(cn=*{bit:s}*)(uid=*{bit:s}*)'.format(bit=word)
ldap_query = '(&{:s})'.format(''.join(
'(|(cn=*{bit:s}*)(uid=*{bit:s}*))'.format(bit=word)
for word in search_words if word.isalnum()
))
if ldap_query != "(|)":