Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.0] patch catch ldap error #5

Open
wants to merge 1 commit into
base: 9.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion addons/web/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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:
Copy link

@houssine78 houssine78 Mar 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah oui, je n'avais pas vu que c'était dans le module standard, je comprends pourquoi tu dis que c'est crade...

et quoi overrider la fonction authenticate de l'OpenERPSession n'est pas possible ? https://github.com/OCA/OCB/blob/9.0/openerp/http.py#L1111

ça me parait plus propre de le faire dans un module à part en auto_install lié au module LDAP ou dans l'inclure dans module LDAP lui-même ce qui a le plus de sens.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robinkeunen du coup ce que je propose ici à plus de sens.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@houssine78 Yes, ça a du sens, mais si j'en viens à de telle nécessités c'est parce que les autres options ne marchent pas, l'exception me file entre les doigts. @vvrossem s'est aussi cassé les dents.

(j'ai pas essayé de faire juste un module d'overide, juste de patcher auth_users et auth_ldap)

uid = False
if uid is not False:
request.params['login_success'] = True
if not redirect:
Expand Down