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) username, password = LocalState.get_credentials(is_admin=False) encrypted_password = LocalState.encrypt_password(username, password) uac = UserAppClient(LocalState.get_login_host(options.keyname), secret) try: uac.change_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)
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) username, password = LocalState.get_credentials(is_admin=False) encrypted_password = LocalState.encrypt_password(username, password) uac = UserAppClient(LocalState.get_login_host(options.keyname), secret) try: uac.change_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)