persist last user_id for session restore across app restarts

Saves the active user_id to a flat-path file on activate_user_session
and clears it on deactivate_user_session (explicit logout). On startup,
if saved credentials and a last_user_id both exist, the per-user session
is restored before loading ToS acceptance or attempting auto-login.

This fixes the chicken-and-egg problem where ToS acceptance lived in the
per-user DB but was needed before login to allow auto-login.
This commit is contained in:
vicrodh committed 2026-02-06 00:37:52 -06:00
1 parent 03736ef8f2
commit b6d2e10471
4 files changed
+62 -6

No files matched your search

+1
View File
@@ -429,6 +429,7 @@ pub fn run() {
commands::clear_saved_credentials,
commands::auto_login,
// User session lifecycle
commands::get_last_user_id,
commands::activate_user_session,
commands::deactivate_user_session,
// Search commands