Skip to content
Snippets Groups Projects
Commit 8a7394a5 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] auth_ldap: filter format

The LDAP method filter_format(filter_template,assertion_values) requires
that the length of assertion_values matches the count of %s in
filter_template. If not, a TypeError exception is thrown.

This fix catches the exception and displays an understandable error
message instead.

opw-608126
opw-657370
parent 3a1c6932
Branches
Tags
No related merge requests found
......@@ -96,7 +96,11 @@ class CompanyLDAP(osv.osv):
return False
entry = False
filter = filter_format(conf['ldap_filter'], (login,))
try:
filter = filter_format(conf['ldap_filter'], (login,))
except TypeError:
_logger.warning('Could not format LDAP filter. Your filter should contain one \'%s\'.')
return False
try:
results = self.query(conf, filter)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment