2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 18:57:13 +00:00

iniital framework for testing shared use cookie

This commit is contained in:
2025-06-25 22:34:09 +03:00
parent 3d12397d9a
commit 19844cd94a

View File

@@ -79,10 +79,14 @@ except:
pass
def get_cookie_max_age():
"""This is where we detect whether the machine the user is using is a shared-use device or a personbal device.
"""This is where we detect whether the machine the user is using is a shared-use device or a personal device.
If it is shared-use, then we set a much shorter cookie timout period.
"""
return COOKIE_MAX_AGE
if shared_use_machine():
return COOKIE_SHORT_TIMEOUT
else:
return COOKIE_MAX_AGE
def sanitize_name(name):
"""Filenames sould not contain these characters as then the system barf when it tries to use them in URLs
@@ -304,10 +308,15 @@ def get_git_string(user):
return None
person = people[0]
return f"{person.fullname} <{user.email}>"
def shared_use_machine():
"""Looks for a cookie which only exists on shared use machines
"""
return False
def get_cookie(request):
"""The initial idea of having a default turned out to be a bad idea as people just ignore the field.
if the default value is blank, then the form validation code makes the user type something in.
If the default value is blank, then the form validation code makes the user type something in.
So having a blank is best if the cookie is to be displayed as the first value seen on a form.
But if the cookie is to be stored, then "Unset" may be better.
"""