Development

This commit is contained in:
Matthew Grotke 2026-06-13 09:25:57 -04:00
parent 44261e5b5c
commit 8a8e947fcf
9 changed files with 289 additions and 33 deletions

View file

@ -24,6 +24,21 @@ def form_login():
flash('Email address and password are required.', 'error')
return redirect(f'/{_PAGE}')
if settings.is_single_user():
stored_hash = settings.get_initial_manager_password_hash()
if email != settings.get_initial_manager_email() or not stored_hash:
flash('Invalid email address or password.', 'error')
return redirect(f'/{_PAGE}')
if not bcrypt.checkpw(password.encode('utf-8'), stored_hash.encode('utf-8')):
flash('Invalid email address or password.', 'error')
return redirect(f'/{_PAGE}')
session.clear()
session['logged_in'] = True
session['timezone'] = settings.get_host_timezone()
session['apply_changes_immediately'] = False
session.permanent = True
return redirect('/overview')
account = config_utils.get_account_by_email(email)
if account is None: