Development

This commit is contained in:
Matthew Grotke 2026-06-12 11:16:31 -04:00
parent c561f2f548
commit 1beb660be1
8 changed files with 280 additions and 48 deletions

View file

@ -43,6 +43,7 @@ def init_accounts_db():
email TEXT NOT NULL UNIQUE,
access_level INTEGER NOT NULL,
hashed_password TEXT,
requested_email TEXT,
created_ts INTEGER NOT NULL,
created_by TEXT NOT NULL
);
@ -68,6 +69,11 @@ def init_accounts_db():
);
''')
con.commit()
try:
con.execute('ALTER TABLE accounts ADD COLUMN requested_email TEXT')
con.commit()
except Exception:
pass
con.close()
_LEVEL_INT_TO_STR = {0: 'nothing', 1: 'viewer', 2: 'administrator', 3: 'manager'}
@ -83,6 +89,7 @@ def _account_row_to_dict(row):
d['access_level_int'] = d.get('access_level', 1)
d['access_level'] = _LEVEL_INT_TO_STR.get(d['access_level_int'], 'viewer')
d['account_status'] = 'active' if d.get('hashed_password') else 'pending'
d['requested_email'] = d.get('requested_email') or ''
d['account_created_by'] = d.get('created_by', '')
ts = d.get('created_ts', 0)
try: