# # file:: cmd_passwd.rb # This source code copyright (C) 2009 Craig Smith # All rights reserved. # # Released under the terms of the TeensyMUD Public License # See LICENSE file for additional information. # module Cmd bindtextdomain("cmd") # Changes your account password def cmd_passwd(args) return if not @account case args when nil,"" sendto _("Change password to what?") else if args=~/(\w+)\s+(.+)/ and world.is_admin? id who = $1 newpass = $2 d = world.all_characters.find {|pid| get_object(pid).name=~/^#{who}$/i } ch = get_object(d) if ch acct = get_object(ch.acctid) if acct acct.passwd = newpass.encrypt sendto _("Successfully changed %{name}'s password" % {:name => who}) else sendto _("Unable to lookup accuont information.") end else sendto _("Could not find player %{name}." % {:name => who}) end else @account.passwd = args.encrypt sendto _("Password changed") end end end end