Browse Source

[ADD] logout function

pull/2/head
Holger Brunn 11 years ago
parent
commit
38930b3825
  1. 15
      auth_from_http_basic/__init__.py

15
auth_from_http_basic/__init__.py

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
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 from openerp.addons.web.controllers import main as web_main
old_init = WebRequest.init old_init = WebRequest.init
@ -38,3 +38,16 @@ def init(self, params):
)) ))
WebRequest.init = init 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
Loading…
Cancel
Save