From 38930b3825c76f1fb1660339dbefcd0914515c79 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Fri, 17 Jan 2014 20:57:27 +0100 Subject: [PATCH] [ADD] logout function --- auth_from_http_basic/__init__.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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