本文整理汇总了Python中appcontroller_client.AppControllerClient.reset_password方法的典型用法代码示例。如果您正苦于以下问题:Python AppControllerClient.reset_password方法的具体用法?Python AppControllerClient.reset_password怎么用?Python AppControllerClient.reset_password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appcontroller_client.AppControllerClient
的用法示例。
在下文中一共展示了AppControllerClient.reset_password方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reset_password
# 需要导入模块: from appcontroller_client import AppControllerClient [as 别名]
# 或者: from appcontroller_client.AppControllerClient import reset_password [as 别名]
def reset_password(cls, options):
"""Resets a user's password the currently running AppScale deployment.
Args:
options: A Namespace that has fields for each parameter that can be
passed in via the command-line interface.
"""
secret = LocalState.get_secret_key(options.keyname)
login_host = LocalState.get_login_host(options.keyname)
username, password = LocalState.get_credentials(is_admin=False)
encrypted_password = LocalState.encrypt_password(username, password)
acc = AppControllerClient(login_host,secret)
try:
acc.reset_password(username, encrypted_password)
AppScaleLogger.success("The password was successfully changed for the " \
"given user.")
except Exception as exception:
AppScaleLogger.warn("Could not change the user's password for the " + \
"following reason: {0}".format(str(exception)))
sys.exit(1)