I made some changes to my change password page for the webmail interface and am having a problem with the Javascript. Can somebody please post the original code for the following file:
/usr/local/cpanel/base/webmail/webmailpasswd.cgi
I made some changes to my change password page for the webmail interface and am having a problem with the Javascript. Can somebody please post the original code for the following file:
/usr/local/cpanel/base/webmail/webmailpasswd.cgi
#!/usr/bin/perl
BEGIN {
push(@INC,"/usr/local/cpanel");
}
use strict;
use Cpanel;
use Cpanel::Form qw(parseform);
use Cpanel::WebMail;
my $cp = Cpanel->new;
$cp->initcp((getpwuid($>))[0]);
my $webmail = Cpanel::WebMail->new();
$webmail->httpheader();
$webmail->header();
print <<EOM;
<script language="JavaScript"><!--
function CheckForm()
{
var str = document.forms[0].elements[1].value;
var str2 = document.forms[0].elements[2].value;
if (str == "")
{
alert("The New Password field is blank.\\n\\nPlease enter your Password.");
document.forms[0].elements[1].select();
document.forms[0].elements[1].focus();
return false;
}
if (str.length < 5)
{
alert("The New Password must be at least 5 characters.");
document.forms[0].elements[1].select();
document.forms[0].elements[1].focus();
return false;
}
if (str.length > 15)
{
alert("The New Password can only be 15 characters long.");
document.forms[0].elements[1].select();
document.forms[0].elements[1].focus();
return false;
}
if (str != str2)
{
alert("The New Password fields don't match.");
document.forms[0].elements[1].select();
document.forms[0].elements[1].focus();
return false;
}
return true;
}
// --></script>
<body bgcolor=#FFFFFF>
Changing password<br><br>
<form action="$webmail->{urlbase}/dowebmailpasswd.cgi" onSubmit="return CheckForm();">
<table border="0">
<TBODY>
<tr>
<input maxLength="15" name="oldpass" size="8"
type="hidden" value>
<td width="50%"><font face="Arial" size="1"><strong>New
Password:</font></strong></font></td>
<td width="50%"><font face="Arial"><input maxLength="15" name="newpass" size="8"
type="password" value></font></td>
</tr>
<tr>
<td width="50%"><font face="Arial" size="1"><strong>New
Password (again):</font></strong></font></td>
<td width="50%"><font face="Arial"><input maxLength="15" size="8" type="password" value></font></td>
</tr>
</TBODY>
</table>
<div align="left"><p><font face="Arial"><br>
<input name="B1" type="submit" value="Change Password"></font></p>
</div>
</form>
EOM
print <<EOM;
<a href="$webmail->{urlbase}/">Return</a>
EOM
$webmail->footer();
~
~