The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need The Original Code For This Page

Discussion in 'General Discussion' started by Jeff75, Jan 9, 2004.

  1. Jeff75

    Jeff75 Well-Known Member

    Joined:
    Apr 11, 2003
    Messages:
    555
    Likes Received:
    0
    Trophy Points:
    16
    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
     
  2. vijaykiran

    vijaykiran Well-Known Member

    Joined:
    Sep 17, 2003
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    kernel
    #!/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();
    ~
    ~
     
Loading...

Share This Page