diff --git a/auth_from_http_basic/__init__.py b/auth_from_http_basic/__init__.py index 4a12fa791..0f0a6e46c 100644 --- a/auth_from_http_basic/__init__.py +++ b/auth_from_http_basic/__init__.py @@ -18,7 +18,7 @@ # along with this program. If not, see . # ############################################################################## -from openerp.addons.web.http import WebRequest +from openerp.addons.web.http import WebRequest, JsonRequest from openerp.addons.web.controllers import main as web_main old_init = WebRequest.init @@ -38,3 +38,16 @@ def init(self, params): )) WebRequest.init = init + +old_dispatch = JsonRequest.dispatch + +def dispatch(self, method): + response = old_dispatch(self, method) + if method.im_func == web_main.Session.destroy.im_func: + response.status = '301 logout' + response.headers.add( + 'Location', + self.httprequest.url.replace('://', '://logout@')) + return response + +JsonRequest.dispatch = dispatch