From 0e33916a826b9e087476a57e4f3ad6e54c371630 Mon Sep 17 00:00:00 2001 From: "robin.keunen" Date: Fri, 27 Mar 2020 16:09:14 +0100 Subject: [PATCH] [PATCH] web: catch LDAP Error --- addons/web/controllers/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 641ad512f46a4..b706f637677de 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -38,6 +38,7 @@ from openerp.http import request, serialize_exception as _serialize_exception, content_disposition from openerp.exceptions import AccessError, UserError from openerp.service.report import exp_report, exp_report_get +from ldap import LDAPError _logger = logging.getLogger(__name__) @@ -478,7 +479,10 @@ def web_login(self, redirect=None, **kw): if request.httprequest.method == 'POST': old_uid = request.uid - uid = request.session.authenticate(request.session.db, request.params['login'], request.params['password']) + try: + uid = request.session.authenticate(request.session.db, request.params['login'], request.params['password']) + except LDAPError: + uid = False if uid is not False: request.params['login_success'] = True if not redirect: