feat: add reset webpanel admin credentials
This commit is contained in:
@ -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.'''
|
||||
|
||||
Reference in New Issue
Block a user