znmud-0.0.1/benchmark/
znmud-0.0.1/cmd/
znmud-0.0.1/cmd/emotes/
znmud-0.0.1/cmd/objects/
znmud-0.0.1/cmd/tiny/
znmud-0.0.1/doc/
znmud-0.0.1/farts/
znmud-0.0.1/lib/
znmud-0.0.1/lib/combat/
znmud-0.0.1/lib/core/bodytypes/
znmud-0.0.1/lib/engine/
znmud-0.0.1/lib/farts/
znmud-0.0.1/logs/
#
# 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