diff options
Diffstat (limited to 'core')
-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. """ |