ska-referee-test/ref-test/app/views.py

30 lines
805 B
Python
Raw Normal View History

2022-06-15 11:33:09 +01:00
from ..config import Config
from flask import Blueprint, redirect, request, render_template
from datetime import datetime, timedelta
views = Blueprint(
name='common',
import_name=__name__,
template_folder='templates',
static_folder='static'
)
@views.route('/privacy/')
def _privacy():
2022-06-15 11:33:09 +01:00
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