MCPcopy
hub / github.com/AstrBotDevs/AstrBot / password

Function password

astrbot/cli/commands/cmd_password.py:18–38  ·  view source on GitHub ↗

Change the AstrBot dashboard password.

(username: str | None)

Source from the content-addressed store, hash-verified

16 help="Optional dashboard username to set together with the new password.",
17)
18def password(username: str | None) -> None:
19 """Change the AstrBot dashboard password."""
20 config = _load_config()
21
22 new_password = click.prompt(
23 "New dashboard password",
24 hide_input=True,
25 confirmation_prompt=True,
26 )
27 validated_password = _validate_dashboard_password(new_password)
28
29 if username is not None:
30 validated_username = _validate_dashboard_username(username.strip())
31 _set_nested_item(config, "dashboard.username", validated_username)
32
33 _set_dashboard_password(config, validated_password)
34 _save_config(config)
35
36 click.echo("Dashboard password updated.")
37 if username is not None:
38 click.echo(f"Dashboard username updated: {validated_username}")

Callers

nothing calls this directly

Calls 6

_load_configFunction · 0.85
_set_nested_itemFunction · 0.85
_set_dashboard_passwordFunction · 0.85
_save_configFunction · 0.85

Tested by

no test coverage detected