mud_server.admin_gradio.tabs.settings_tab ========================================= .. py:module:: mud_server.admin_gradio.tabs.settings_tab .. autoapi-nested-parse:: 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 --------- .. autoapisummary:: mud_server.admin_gradio.tabs.settings_tab.change_password mud_server.admin_gradio.tabs.settings_tab.stop_server mud_server.admin_gradio.tabs.settings_tab.create Module Contents --------------- .. py:function:: change_password(old_password, new_password, confirm_password, session_state) 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. :param old_password: Current password (for verification) :param new_password: Desired new password :param confirm_password: New password confirmation :param session_state: User's session state dictionary containing session_id :returns: Status message string indicating success or failure .. admonition:: 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 .. py:function:: stop_server(session_state) 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. :param session_state: User's session state dictionary containing session_id and role :returns: Status message string indicating success or error .. admonition:: Examples >>> session = {"session_id": "abc123", "role": "admin", "logged_in": True} >>> result = stop_server(session) >>> isinstance(result, str) True .. py:function:: create(session_state) Create the Settings tab with password change and server control. :param session_state: Gradio State component for session tracking :returns: Configured Settings tab component :rtype: gr.Tab