diff --git a/addons/portal/controllers/portal.py b/addons/portal/controllers/portal.py index 1db9192123f..95558475059 100644 --- a/addons/portal/controllers/portal.py +++ b/addons/portal/controllers/portal.py @@ -246,15 +246,13 @@ class CustomerPortal(Controller): try: request.env['res.users'].change_password(old, new1) - except UserError as e: - return {'errors': {'password': e.name}} except AccessDenied as e: - # FIXME XMO dead code since https://github.com/odoo/odoo/pull/45723 - # AccessDenied is an UserError now msg = e.args[0] if msg == AccessDenied().args[0]: msg = _('The old password you provided is incorrect, your password was not changed.') return {'errors': {'password': {'old': msg}}} + except UserError as e: + return {'errors': {'password': e.name}} # update session token so the user does not get logged out (cache cleared by passwd change) new_token = request.env.user._compute_session_token(request.session.sid)