diff options
| author | David Beguin <dbe@odoo.com> | 2019-08-27 11:34:59 +0000 |
|---|---|---|
| committer | David Beguin <dbe@odoo.com> | 2019-08-27 12:12:37 +0000 |
| commit | e74c6ef86a63b7d8ef50d8214b8ac48ea9f69f7e (patch) | |
| tree | f32905e9a8e561bec6b2b8b263d6225a50709300 /addons/website_livechat | |
| parent | ed19f90992ce06ce6f91e3cf85a4fd1f10209f9a (diff) | |
[FIX] website : fix visitor cookie expiration
Before this commit, the visitor cookie was expiring by default on
browser session close on firefox. On Chrome, the cookie was always
valid after browser session closing.
On Firefox, the expiration date must be set to make the cookie still valid
after closing the browser.
The same thing happened with livechat_session cookies set
in context of livechat request.
The cookie expiration date (100 years to 'never' expire) have been added.
Linked to original Task ID : 2028059
Task ID : 2060381
PR #36126
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/website_livechat')
| -rw-r--r-- | addons/website_livechat/models/website_visitor.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/website_livechat/models/website_visitor.py b/addons/website_livechat/models/website_visitor.py index c27c002a99a..e4020760f8f 100644 --- a/addons/website_livechat/models/website_visitor.py +++ b/addons/website_livechat/models/website_visitor.py @@ -1,9 +1,11 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from datetime import datetime, timedelta +import json + from odoo import models, api, fields, _ from odoo.exceptions import UserError -import json class WebsiteVisitor(models.Model): @@ -99,4 +101,5 @@ class WebsiteVisitor(models.Model): "uuid": chat_request_channel.uuid, "type": "chat_request" }) - response.set_cookie('im_livechat_session', livechat_session) + expiration_date = datetime.now() + timedelta(days=100*365) # never expire + response.set_cookie('im_livechat_session', livechat_session, expires=expiration_date.timestamp()) |
