diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2025-06-25 22:34:09 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2025-06-25 22:34:09 +0300 |
commit | 19844cd94a4a7c798921a2858f038eb9a2db99a5 (patch) | |
tree | 562be60fca7d79f88e29d9396bcd54fcdf418047 | |
parent | 3d12397d9a2235ab8d166512471e40dd585d3371 (diff) | |
download | troggle-19844cd94a4a7c798921a2858f038eb9a2db99a5.tar.gz troggle-19844cd94a4a7c798921a2858f038eb9a2db99a5.tar.bz2 troggle-19844cd94a4a7c798921a2858f038eb9a2db99a5.zip |
iniital framework for testing shared use cookie
-rw-r--r-- | core/utils.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/core/utils.py b/core/utils.py index 8e8d6e4..a2f55dd 100644 --- a/core/utils.py +++ b/core/utils.py @@ -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. """ |