From 9b99c2dc573e48e1e7e8421cb419cf0ba3dd4988 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Wed, 30 Jul 2014 11:05:07 +0200 Subject: [PATCH] [FIX] if the default login page is disabled, redirect with *401* --- auth_from_http_remote_user/controllers/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/auth_from_http_remote_user/controllers/main.py b/auth_from_http_remote_user/controllers/main.py index eff4d29a6..5724c5896 100644 --- a/auth_from_http_remote_user/controllers/main.py +++ b/auth_from_http_remote_user/controllers/main.py @@ -29,6 +29,7 @@ from .. import utils import random import logging +import werkzeug _logger = logging.getLogger(__name__) @@ -42,7 +43,10 @@ class Home(main.Home): def web_client(self, s_action=None, **kw): main.ensure_db() if not request.session.uid: - self._bind_http_remote_user(http.request.session.db) + try: + self._bind_http_remote_user(http.request.session.db) + except http.AuthenticationError: + return werkzeug.exceptions.Unauthorized() return super(Home, self).web_client(s_action, **kw) def _get_user_id_from_attributes(self, res_users, cr, attrs):