/* Change the password of a user in a given realm */

parse arg realm user password admin_user admin_password

if realm = "?" | realm = "/?" | length(realm) = 0 | length(user) = 0 then do
	say "Utility to Change the Password of a User in a PowerWeb Server++ User Database."
	say ""
	say "Usage:     ChangePW Realm NewUserName NewUserPassword [AdminName [AdminPassword]]"
	say ""
	say "Example 1: ChangePW admin joe xyz"
	say "Example 2: ChangePW admin joe xyz admin secret"
	say ""
	say "If the admin user name is omitted, it defaults to 'admin'."
	say "If the admin user password is omitted, it defaults to empty."
	return
end

if length(admin_user) = 0 then
	admin_user = 'admin'

http = '/!user?Realm=/security/userbase/'realm'&user='user'&password='password'&verify='password'&file=&Submit=Change%%20the%%20Password'

call CallHTTP http, admin_user, admin_password, "User Results", "Copyright"

return

