mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 19:57:29 +01:00
Improve cookie parameters
This commit is contained in:
parent
7ce2ee1f5b
commit
bfe48924c7
@ -191,7 +191,7 @@ def set_locale():
|
|||||||
if locale:
|
if locale:
|
||||||
expire_date = datetime.datetime.now()
|
expire_date = datetime.datetime.now()
|
||||||
expire_date = expire_date + datetime.timedelta(days=5*365)
|
expire_date = expire_date + datetime.timedelta(days=5*365)
|
||||||
resp.set_cookie("locale", locale, expires=expire_date)
|
resp.set_cookie("locale", locale, expires=expire_date, secure=True, samesite="Lax")
|
||||||
|
|
||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
current_user.locale = locale
|
current_user.locale = locale
|
||||||
@ -204,10 +204,10 @@ def set_locale():
|
|||||||
def set_nonfree():
|
def set_nonfree():
|
||||||
resp = redirect(url_for("homepage.home"))
|
resp = redirect(url_for("homepage.home"))
|
||||||
if request.cookies.get("hide_nonfree") == "1":
|
if request.cookies.get("hide_nonfree") == "1":
|
||||||
resp.set_cookie("hide_nonfree", "0", expires=0)
|
resp.set_cookie("hide_nonfree", "0", expires=0, secure=True, samesite="Lax")
|
||||||
else:
|
else:
|
||||||
expire_date = datetime.datetime.now()
|
expire_date = datetime.datetime.now()
|
||||||
expire_date = expire_date + datetime.timedelta(days=5*365)
|
expire_date = expire_date + datetime.timedelta(days=5*365)
|
||||||
resp.set_cookie("hide_nonfree", "1", expires=expire_date)
|
resp.set_cookie("hide_nonfree", "1", expires=expire_date, secure=True, samesite="Lax")
|
||||||
|
|
||||||
return resp
|
return resp
|
||||||
|
Loading…
Reference in New Issue
Block a user