[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
This commit is contained in:
Nicolas Martinelli 2015-12-04 11:23:49 +01:00
parent 3a1c693259
commit 8a7394a550
1 changed files with 5 additions and 1 deletions

View File

@ -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)