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_password(old_password, new_password, ...)

Change the current user's password.

stop_server(session_state)

Stop the backend server (Admin/Superuser only).

create(session_state)

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:
  • old_password (str) – Current password (for verification)

  • new_password (str) – Desired new password

  • confirm_password (str) – New password confirmation

  • session_state (dict) – User’s session state dictionary containing session_id

Returns:

Status message string indicating success or failure

Return type:

str

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:

str

Examples

>>> session = {"session_id": "abc123", "role": "admin", "logged_in": True}
>>> result = stop_server(session)
>>> isinstance(result, str)
True
mud_server.admin_gradio.tabs.settings_tab.create(session_state)[source]

Create the Settings tab with password change and server control.

Parameters:

session_state – Gradio State component for session tracking

Returns:

Configured Settings tab component

Return type:

gr.Tab