2021-11-28 02:30:46 +00:00
|
|
|
from datetime import datetime, timedelta
|
|
|
|
from flask import Blueprint, redirect, request
|
|
|
|
|
|
|
|
cookie_consent = Blueprint(
|
|
|
|
'cookie_consent',
|
|
|
|
__name__
|
|
|
|
)
|
|
|
|
@cookie_consent.route('/')
|
|
|
|
def _cookies():
|
2021-12-08 11:26:18 +00:00
|
|
|
from main import app
|
2021-11-28 02:30:46 +00:00
|
|
|
resp = redirect('/')
|
|
|
|
resp.set_cookie(
|
|
|
|
key = 'cookie_consent',
|
|
|
|
value = 'True',
|
2021-12-08 11:26:18 +00:00
|
|
|
max_age = timedelta(days=14) if request.cookies.get('remember') == 'True' else None,
|
2021-11-28 02:30:46 +00:00
|
|
|
path = '/',
|
2021-12-08 11:26:18 +00:00
|
|
|
expires = datetime.utcnow() + timedelta(days=14) if request.cookies.get('remember') else None,
|
|
|
|
domain = f'.{app.config["SERVER_NAME"]}',
|
2021-12-06 21:51:29 +00:00
|
|
|
secure = True
|
2021-11-28 02:30:46 +00:00
|
|
|
)
|
|
|
|
return resp
|