feat: add reset webpanel admin credentials

This commit is contained in:
Whispering Wind
2025-05-23 13:01:22 +03:30
committed by GitHub
parent b5af06708d
commit c7ed9b3aef
3 changed files with 99 additions and 0 deletions

View File

@ -588,6 +588,18 @@ def get_webpanel_api_token() -> str | None:
'''Gets the API token of WebPanel.'''
return run_cmd(['bash', Command.SHELL_WEBPANEL.value, 'api-token'])
def reset_webpanel_credentials(new_username: str | None = None, new_password: str | None = None):
'''Resets the WebPanel admin username and/or password.'''
if not new_username and not new_password:
raise InvalidInputError('Error: At least new username or new password must be provided.')
cmd_args = ['bash', Command.SHELL_WEBPANEL.value, 'resetcreds']
if new_username:
cmd_args.extend(['-u', new_username])
if new_password:
cmd_args.extend(['-p', new_password])
run_cmd(cmd_args)
def get_services_status() -> dict[str, bool] | None:
'''Gets the status of all project services.'''