diff --git a/ref-test/app/views.py b/ref-test/app/views.py index ef48434..b77274e 100644 --- a/ref-test/app/views.py +++ b/ref-test/app/views.py @@ -1,4 +1,8 @@ -from flask import Blueprint, render_template +from ..config import Config + +from flask import Blueprint, redirect, request, render_template + +from datetime import datetime, timedelta views = Blueprint( name='common', @@ -9,4 +13,18 @@ views = Blueprint( @views.route('/privacy/') def _privacy(): - return render_template('privacy.html') \ No newline at end of file + return render_template('privacy.html') + +@views.route('/cookie_consent/') +def _cookie_consent(): + 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'.{Config.SERVER_NAME}', + secure = True + ) + return resp \ No newline at end of file