Finished common views
This commit is contained in:
parent
a1bee61679
commit
1a7983052f
@ -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(
|
views = Blueprint(
|
||||||
name='common',
|
name='common',
|
||||||
@ -10,3 +14,17 @@ views = Blueprint(
|
|||||||
@views.route('/privacy/')
|
@views.route('/privacy/')
|
||||||
def _privacy():
|
def _privacy():
|
||||||
return render_template('privacy.html')
|
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
|
Loading…
Reference in New Issue
Block a user