summaryrefslogtreecommitdiffstats
path: root/core/views/other.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2025-06-14 20:36:31 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2025-06-14 20:36:31 +0300
commit40fb066e2be579f07e8219bfa2306d66278b4b00 (patch)
tree992f58f2ac0d1fe8cf2c5888d1a957f2272bc2ee /core/views/other.py
parentd8cdf7bc5ac1d258b36a8548c354e82ca314197a (diff)
downloadtroggle-40fb066e2be579f07e8219bfa2306d66278b4b00.tar.gz
troggle-40fb066e2be579f07e8219bfa2306d66278b4b00.tar.bz2
troggle-40fb066e2be579f07e8219bfa2306d66278b4b00.zip
refactoring cookie age as a function not a constant
Diffstat (limited to 'core/views/other.py')
-rw-r--r--core/views/other.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/views/other.py b/core/views/other.py
index 6d1b175..fd1d1ef 100644
--- a/core/views/other.py
+++ b/core/views/other.py
@@ -11,7 +11,7 @@ from troggle.core.models.logbooks import LogbookEntry, writelogbook # , PersonL
# from databaseReset import reinit_db # don't do this. databaseRest runs code *at import time*
from troggle.core.models.troggle import Expedition
-from troggle.core.utils import current_expo, COOKIE_MAX_AGE
+from troggle.core.utils import current_expo, COOKIE_SHORT_TIMEOUT
from troggle.parsers.imports import (
import_caves,
import_drawingsfiles,
@@ -38,9 +38,11 @@ todo = """
def public_laptop(request):
"""Just sets a cookie. Visit this web page from Crowley, Anathema, Aziraphale, Pulsifer etc.
+
+ This hack to be replaced in due course by a proper call from a user saying whether they are using a shared machine or not.
"""
- response = HttpResponse("Cookie has been set on this machine, which now defines it as a public laptop. So login cookie lifetimes will now be short.")
- response.set_cookie("public_laptop", "this is a public laptop", max_age=COOKIE_MAX_AGE) # Cookie expires in 1 hour
+ response = HttpResponse(f"Cookie has been set on this machine, which now defines it as a public laptop. So the login cookie lifetimes will now be short:{COOKIE_SHORT_TIMEOUT/(60*60)} hour(s)")
+ response.set_cookie("public_laptop", "this is a public laptop", max_age=COOKIE_SHORT_TIMEOUT) # Cookie expires in 1 hour
return response
def todos(request, module):