Cookie bugfix, removed 'session' string from expiry/age

This commit is contained in:
Vivek Santayana 2021-12-08 11:26:18 +00:00
parent 6be20568a8
commit 70671adac8

View File

@ -7,14 +7,15 @@ cookie_consent = Blueprint(
) )
@cookie_consent.route('/') @cookie_consent.route('/')
def _cookies(): def _cookies():
from main import app
resp = redirect('/') resp = redirect('/')
resp.set_cookie( resp.set_cookie(
key = 'cookie_consent', key = 'cookie_consent',
value = 'True', 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 = '/', path = '/',
expires = datetime.utcnow() + timedelta(days=14) if request.cookies.get('remember') else 'Session', expires = datetime.utcnow() + timedelta(days=14) if request.cookies.get('remember') else None,
domain = '.reftest.vsnt.uk', domain = f'.{app.config["SERVER_NAME"]}',
secure = True secure = True
) )
return resp return resp