mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 14:47:08 +00:00
iniital framework for testing shared use cookie
This commit is contained in:
@@ -79,11 +79,15 @@ except:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_cookie_max_age():
|
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.
|
If it is shared-use, then we set a much shorter cookie timout period.
|
||||||
"""
|
"""
|
||||||
|
if shared_use_machine():
|
||||||
|
return COOKIE_SHORT_TIMEOUT
|
||||||
|
else:
|
||||||
return COOKIE_MAX_AGE
|
return COOKIE_MAX_AGE
|
||||||
|
|
||||||
|
|
||||||
def sanitize_name(name):
|
def sanitize_name(name):
|
||||||
"""Filenames sould not contain these characters as then the system barf when it tries to use them in URLs
|
"""Filenames sould not contain these characters as then the system barf when it tries to use them in URLs
|
||||||
"""
|
"""
|
||||||
@@ -305,9 +309,14 @@ def get_git_string(user):
|
|||||||
person = people[0]
|
person = people[0]
|
||||||
return f"{person.fullname} <{user.email}>"
|
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):
|
def get_cookie(request):
|
||||||
"""The initial idea of having a default turned out to be a bad idea as people just ignore the field.
|
"""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.
|
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.
|
But if the cookie is to be stored, then "Unset" may be better.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user