2
# Programmer: Chris Bunch
6
require 'soap/rpc/driver'
9
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
10
require 'app_controller_client'
11
require 'common_functions'
12
require 'encryption_helper'
13
require 'user_app_client'
15
USAGE = <<END_OF_USAGE
18
Usage: appscale-reset-pwd [OPTIONS]
21
appscale-reset-pwd --keyname foo
24
--keyname: The name of the SSH key to use for Eucalyptus. Two AppScale instances can be run concurrently in one cloud if they have unique names, and they can conflict if they have the same name.
27
ALL_FLAGS = ["help", "usage", "h", "keyname", "version"]
32
secret = CommonFunctions.get_secret_key(keyname)
34
head_node_ip = CommonFunctions.get_load_balancer_ip(keyname)
35
abort("We are not able to reset your password right now, as AppScale is not currently running.") if head_node_ip == ""
37
user = CommonFunctions.get_email
38
pass = CommonFunctions.get_password
40
encrypted_pass = CommonFunctions.encrypt_password(user, pass)
42
acc = AppControllerClient.new(head_node_ip, secret)
43
userappserver_ip = acc.get_userappserver_ip
45
uac = UserAppClient.new(userappserver_ip, secret)
46
uac.change_password(user, encrypted_pass)