Sha256: 656ad5e54a0054b9f86cd36d1bf01f98dc6a2caff13389692b4f4e574a1172ac
Contents?: true
Size: 1.54 KB
Versions: 66
Compression:
Stored size: 1.54 KB
Contents
module TreasureData module Command def password_change(op) op.cmd_parse old_password = nil password = nil begin system "stty -echo" # TODO termios print "Old password (typing will be hidden): " old_password = STDIN.gets || "" old_password = old_password[0..-2] # strip \n rescue Interrupt $stderr.print "\ncanceled." exit 1 ensure system "stty echo" # TODO termios print "\n" end if old_password.empty? $stderr.puts "canceled." exit 0 end 3.times do begin system "stty -echo" # TODO termios print "New password (typing will be hidden): " password = STDIN.gets || "" password = password[0..-2] # strip \n rescue Interrupt $stderr.print "\ncanceled." exit 1 ensure system "stty echo" # TODO termios print "\n" end if password.empty? $stderr.puts "canceled." exit 0 end begin system "stty -echo" # TODO termios print "Retype new password: " password2 = STDIN.gets || "" password2 = password2[0..-2] # strip \n rescue Interrupt $stderr.print "\ncanceled." exit 1 ensure system "stty echo" # TODO termios print "\n" end if password == password2 break end puts "Doesn't match." end client = get_client(:ssl => true) client.change_my_password(old_password, password) $stderr.puts "Password changed." end end end
Version data entries
66 entries across 66 versions & 1 rubygems