Development
This commit is contained in:
parent
1beb660be1
commit
025adb9f15
4 changed files with 15 additions and 7 deletions
|
|
@ -68,6 +68,7 @@ def form_login():
|
|||
session.clear()
|
||||
session['account_id'] = account['account_id']
|
||||
session['tz_offset_seconds'] = settings.get_host_utc_offset()
|
||||
session['timezone'] = settings.get_host_timezone()
|
||||
session['apply_changes_immediately'] = False
|
||||
session.permanent = True
|
||||
|
||||
|
|
|
|||
|
|
@ -81,13 +81,6 @@
|
|||
"method": "post",
|
||||
"items": [
|
||||
{"type": "hidden", "name": "row_index", "value": ""},
|
||||
{
|
||||
"type": "field",
|
||||
"label": "Email Address",
|
||||
"name": "email_address_display",
|
||||
"input_type": "text",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"label": "Access Level",
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ class SqliteSessionInterface(SessionInterface):
|
|||
'timezone': str(prefs.get('timezone', '')),
|
||||
'apply_changes_immediately': bool(prefs.get('apply_changes_immediately', False)),
|
||||
'_flashes': flashes,
|
||||
'_permanent': True,
|
||||
}
|
||||
con.close()
|
||||
return SqliteSession(data, sid=sid, new=False)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,19 @@ def get_host_utc_offset():
|
|||
return time.localtime().tm_gmtoff
|
||||
|
||||
|
||||
def get_host_timezone():
|
||||
"""Return the host timezone name (e.g. 'America/New_York'), or '' if unknown."""
|
||||
tz = os.environ.get('TZ', '').strip()
|
||||
if tz:
|
||||
return tz
|
||||
try:
|
||||
with open('/etc/timezone') as f:
|
||||
return f.read().strip()
|
||||
except OSError:
|
||||
pass
|
||||
return ''
|
||||
|
||||
|
||||
def get_credentials_key():
|
||||
"""Return a Fernet-compatible key derived from the CREDENTIALS_KEY environment variable,
|
||||
or None if not set. SHA-256 hashes the raw string to produce 32 bytes, which are then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue