[FIX] auth_ldap: avoid to try twice the authentication to the ldap server

See #1982
This commit is contained in:
Denis Ledoux 2014-09-16 18:33:42 +02:00
parent ce84d6107f
commit 0a9c64c17d
1 changed files with 4 additions and 0 deletions

View File

@ -251,6 +251,10 @@ class users(osv.osv):
return user_id
registry = RegistryManager.get(db)
with registry.cursor() as cr:
cr.execute("SELECT id, active FROM res_users WHERE lower(login)=%s", (login,))
res = cr.fetchone()
if res:
return False
ldap_obj = registry.get('res.company.ldap')
for conf in ldap_obj.get_ldap_dicts(cr):
entry = ldap_obj.authenticate(conf, login, password)