Change the AstrBot dashboard password.
(username: str | None)
| 16 | help="Optional dashboard username to set together with the new password.", |
| 17 | ) |
| 18 | def 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}") |
nothing calls this directly
no test coverage detected