Added cookie consent
This commit is contained in:
@ -152,7 +152,7 @@ $('#dismiss-cookie-alert').click(function(event){
|
||||
|
||||
$.ajax({
|
||||
url: '/cookies/',
|
||||
type: 'GET',
|
||||
type: 'POST',
|
||||
data: {
|
||||
time: Date.now()
|
||||
},
|
||||
|
@ -9,6 +9,7 @@ class Config(object):
|
||||
DEBUG = False
|
||||
TESTING = False
|
||||
SECRET_KEY = os.getenv('SECRET_KEY')
|
||||
SERVER_NAME = os.getenv('SERVER_NAME')
|
||||
SESSION_COOKIE_SECURE = True
|
||||
SQLALCHEMY_DATABASE_URI = f'sqlite:///{Path(DATA)}/database.db'
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
|
@ -68,7 +68,7 @@ $('#dismiss-cookie-alert').click(function(event){
|
||||
|
||||
$.ajax({
|
||||
url: '/cookies/',
|
||||
type: 'GET',
|
||||
type: 'POST',
|
||||
data: {
|
||||
time: Date.now()
|
||||
},
|
||||
|
@ -5,7 +5,7 @@ from flask import Blueprint, redirect, request, render_template
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
views = Blueprint(
|
||||
name='common',
|
||||
name='views',
|
||||
import_name=__name__,
|
||||
template_folder='templates',
|
||||
static_folder='static'
|
||||
@ -15,7 +15,7 @@ views = Blueprint(
|
||||
def _privacy():
|
||||
return render_template('privacy.html')
|
||||
|
||||
@views.route('/cookie_consent/')
|
||||
@views.route('/cookies/', methods=['POST'])
|
||||
def _cookie_consent():
|
||||
resp = redirect('/')
|
||||
resp.set_cookie(
|
||||
@ -24,7 +24,7 @@ def _cookie_consent():
|
||||
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}',
|
||||
domain = f'{Config.SERVER_NAME}',
|
||||
secure = True
|
||||
)
|
||||
return resp
|
Reference in New Issue
Block a user