[IMP] core: make some cookies expire on logout
Some cookies were left around even when the user logged out The next user should log into the default company instead of the company of the last user. task-3077421 closes odoo/odoo#108998 Related: odoo/enterprise#35685 Signed-off-by: Julien Castiaux <juc@odoo.com>
This commit is contained in:
@@ -58,6 +58,11 @@ class Http(models.AbstractModel):
|
||||
super()._pre_dispatch(rule, args)
|
||||
cls._handle_debug()
|
||||
|
||||
@classmethod
|
||||
def _post_logout(cls):
|
||||
super()._post_logout()
|
||||
request.future_response.set_cookie('cids', max_age=0)
|
||||
|
||||
def webclient_rendering_context(self):
|
||||
return {
|
||||
'menu_data': request.env['ir.ui.menu'].load_menus(request.session.debug),
|
||||
|
||||
@@ -150,6 +150,10 @@ class IrHttp(models.AbstractModel):
|
||||
def _post_dispatch(cls, response):
|
||||
request.dispatcher.post_dispatch(response)
|
||||
|
||||
@classmethod
|
||||
def _post_logout(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def _handle_error(cls, exception):
|
||||
return request.dispatcher.handle_error(exception)
|
||||
|
||||
@@ -1002,6 +1002,9 @@ class Session(collections.abc.MutableMapping):
|
||||
self.context['lang'] = request.default_lang() if request else DEFAULT_LANG
|
||||
self.should_rotate = True
|
||||
|
||||
if request and request.env:
|
||||
request.env['ir.http']._post_logout()
|
||||
|
||||
def touch(self):
|
||||
self.is_dirty = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user