Sha256: 89af2424247a2af797001c9b025b92f10adc91d94a6651bb21564fce13c80d4a
Contents?: true
Size: 777 Bytes
Versions: 30
Compression:
Stored size: 777 Bytes
Contents
#!/usr/bin/ruby # # A tool to change the password of a Jabber account # $:.unshift('../../../../../lib') require 'xmpp4r' include Jabber def with_status(str, &block) print "#{str}..." $stdout.flush begin yield puts " Ok" rescue Exception => e puts " Exception: #{e.to_s}" raise e end end # settings if ARGV.length != 3 puts "Run with ./change_password.rb user@server/resource oldpassword newpassword" exit 1 end my_jid = JID.new(ARGV[0]) my_jid.resource = 'change_password' if my_jid.resource.nil? old_password = ARGV[1] new_password = ARGV[2] cl = Client.new(my_jid) with_status('Connecting') { cl.connect } with_status('Authenticating') { cl.auth(old_password) } with_status('Changing password') { cl.password = new_password } cl.close
Version data entries
30 entries across 30 versions & 12 rubygems