MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / logout

Method logout

auth_manager.py:497–517  ·  view source on GitHub ↗

Encrypt database and clear session data.

(self)

Source from the content-addressed store, hash-verified

495 self._db_ready = True # Mark ready anyway so the system isn't stuck
496
497 def logout(self) -> dict:
498 """Encrypt database and clear session data."""
499 try:
500 if self.is_configured() and self._fernet_key:
501 # Acquire the DB lock to prevent other threads from creating
502 # new DB connections during the encrypt window
503 from db_manager import _db_lock
504 with _db_lock:
505 # Close existing DB connections
506 self._close_db()
507 # Give a moment for connections to close
508 time.sleep(0.2)
509 # Encrypt the database
510 if os.path.exists(self.main_db_path):
511 self.encrypt_database()
512 self._fernet_key = None
513
514 return {'success': True}
515 except Exception as e:
516 logger.error(f"Logout encryption failed: {e}")
517 return {'success': False, 'error': str(e)}
518
519 # =========================================================================
520 # PUBLIC API - PASSWORD CHANGE

Callers

nothing calls this directly

Calls 5

is_configuredMethod · 0.95
_close_dbMethod · 0.95
encrypt_databaseMethod · 0.95
errorMethod · 0.80
sleepMethod · 0.45

Tested by

no test coverage detected