#!/usr/bin/perl

print "Content-Type: Text/HTML\n\n";

# This script lists all user accounts and associated email addresses.
# The user is given the option to add/delete addresses, delete users and change a user's pw

use CGI ':standard';
use Vpanel 1.00;
require $header;
require $accountinfo;
$chosen_user = param ('user');
$domainname = find_domain ($mainuser);

# Define the tab which appears to the front
$tab_section = $tabnum_email;

# Output the content associated with this tab
print "<body class=section-$tab_section>";

# display tabs
require $tabdisplay;

# find all existing valid users
@validusers = find_valid_users($domainname);

print_header ("Changing a user's password for $domainname");

print "Please select the user whose password you wish to change and the password you would like to use:<BR><BR>";

print "<table width=20% class=text>";
print "<form method=post action=/vcgi-bin/reset_email_password-confirm.pl class=text>";
print "<tr><td><B>User:</B></td><td><select name=user class=text>";
for $validuser ( @validusers )
{
	$ftpstring = "^ftp";
	$mainuserstring = "$mainuser";
	if ( !($validuser =~ $mainuser) && ( ! ( $validuser =~ /^ftp/ ) ) )
	{
		print "<option value=$validuser";
		if ( $chosen_user eq $validuser )
		{
			print " selected ";
		}
		print ">$validuser";
	}
}
print "</select></td></tr>";

print "<tr><td><B>Password:</B></td><td><select name=password class=text>";
for ( $i = 1 ; $i <= $numpasswords ; $i++ )
{
	@new_password = ();
	@new_password = create_new_password();
	$password = $new_password[0];
	$pronounciation = $new_password[1];
	print "<option name=password value=$password>$password ($pronounciation)";
}
print "</select></td></tr></table>";

print "(The password's pronounciation is in brackets)";

print_end_of_form();

require $footer;
