Class: Central::Cli::User::ResetPasswordCommand

Inherits:
Clamp::Command
  • Object
show all
Includes:
Common
Defined in:
lib/central/cli/user/reset_password_command.rb

Instance Method Summary collapse

Methods included from Common

#access_token=, #add_master, #api_url, #api_url=, #clear_current_stack, #client, #current_master, #current_master=, #current_master_index, #current_stack, #current_stack=, #ensure_custom_ssl_ca, #require_api_url, #require_current_stack, #require_token, #reset_client, #save_settings, #settings, #settings_filename

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/central/cli/user/reset_password_command.rb', line 9

def execute
  require 'highline/import'

  password = ask('Password: ') { |q| q.echo = '*' }
  password2 = ask('Password again: ') { |q| q.echo = '*' }
  abort("Passwords don't match") if password != password2
  params = { token: token, password: password }
  auth_client = Central::Client.new(auth_provider_url)
  auth_client.put('user/password_reset', params)
  puts 'Password is now changed. To login with the new password, please run: cm login'
end