From 70671adac85c9c9e195753297de73e8a4a9d5ae4 Mon Sep 17 00:00:00 2001 From: viveksantayana Date: Wed, 8 Dec 2021 11:26:18 +0000 Subject: [PATCH] Cookie bugfix, removed 'session' string from expiry/age --- ref-test/common/blueprints.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ref-test/common/blueprints.py b/ref-test/common/blueprints.py index 4500c2a..39f0e9c 100644 --- a/ref-test/common/blueprints.py +++ b/ref-test/common/blueprints.py @@ -7,14 +7,15 @@ cookie_consent = Blueprint( ) @cookie_consent.route('/') def _cookies(): + from main import app resp = redirect('/') resp.set_cookie( key = 'cookie_consent', value = 'True', - max_age = timedelta(days=14) if request.cookies.get('remember') == 'True' else 'Session', + max_age = timedelta(days=14) if request.cookies.get('remember') == 'True' else None, path = '/', - expires = datetime.utcnow() + timedelta(days=14) if request.cookies.get('remember') else 'Session', - domain = '.reftest.vsnt.uk', + expires = datetime.utcnow() + timedelta(days=14) if request.cookies.get('remember') else None, + domain = f'.{app.config["SERVER_NAME"]}', secure = True ) return resp \ No newline at end of file