From 7c70da4b5c2aa4dbad8c32c8f7ddc065cbaf9626 Mon Sep 17 00:00:00 2001 From: viveksantayana Date: Wed, 8 Dec 2021 11:29:22 +0000 Subject: [PATCH] Removed personal information --- ref-test/common/blueprints.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ref-test/common/blueprints.py diff --git a/ref-test/common/blueprints.py b/ref-test/common/blueprints.py new file mode 100644 index 0000000..39f0e9c --- /dev/null +++ b/ref-test/common/blueprints.py @@ -0,0 +1,21 @@ +from datetime import datetime, timedelta +from flask import Blueprint, redirect, request + +cookie_consent = Blueprint( + 'cookie_consent', + __name__ +) +@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 None, + path = '/', + 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