mud_server.admin_gradio.tabs.settings_tab
Settings Tab for MUD Client.
This module provides the settings interface for password changes and server control. Visible only when logged in. Server control section is admin/superuser only.
- Migration Notes:
Migrated from old api_client.py to new modular structure
Uses SettingsAPIClient for password change and server control
Wrapper functions extract session_id and role from session_state
Returns message string for Gradio display
Functions
|
Change the current user's password. |
|
Stop the backend server (Admin/Superuser only). |
|
Create the Settings tab with password change and server control. |
Module Contents
- mud_server.admin_gradio.tabs.settings_tab.change_password(old_password, new_password, confirm_password, session_state)[source]
Change the current user’s password.
Validates passwords, sends change request to backend via SettingsAPIClient, and returns status message.
This function wraps the new SettingsAPIClient.change_password() method to maintain compatibility with the Gradio interface while using the new modular API.
- Parameters:
- Returns:
Status message string indicating success or failure
- Return type:
Examples
>>> session = {"session_id": "abc123", "logged_in": True} >>> result = change_password("old123", "newpass123", "newpass123", session) >>> "successfully" in result.lower() or "failed" in result.lower() True
- mud_server.admin_gradio.tabs.settings_tab.stop_server(session_state)[source]
Stop the backend server (Admin/Superuser only).
Sends stop request to backend via SettingsAPIClient and returns status message.
This function wraps the new SettingsAPIClient.stop_server() method to maintain compatibility with the Gradio interface while using the new modular API.
- Parameters:
session_state (dict) – User’s session state dictionary containing session_id and role
- Returns:
Status message string indicating success or error
- Return type:
Examples
>>> session = {"session_id": "abc123", "role": "admin", "logged_in": True} >>> result = stop_server(session) >>> isinstance(result, str) True