I have been trying to debug this for some time, and am not
sure what is happening or why it is happening.

I have a simple gui that takes in old and new passwd and changes
it. For this I have a "change password" button. Now the problem
that I see is sometimes.....when I enter the values in the form and
click on the "change password" button, the same screen comes back to
me without the change actually happening. After doing this couple of 
times, I would actually succeed. Why is my form getting resetted sometimes ?
It does not make a difference if I use IE or Netscape.

Below is the code ...that does most of the work and seems to be the 
problematic code(this is very similar to the examples given in
Stein's and MacEachern's book on Apache modules):

package Apache::ChangePassword;

use strict;
use Apache::Constants qw(:common);
use CGI '-autoload';


sub handler {
      my $r = shift;
      my($oldpass, $newpass1, $confirmpass) = map { param($_) } qw(password
newpassword1 confirmpassword);
      my $request_uri_go = param('request_uri') ||
        ($r->prev ? $r->prev->uri : cookie('request_uri'));     
       
      if($user && $oldpass && $newpass1 && $confirmpass)
      {
        #Do some authentication. But I never come here the first couple of
        #times when I click "change password"
 
      }
      
        make_passwd_screen($msg, $request_uri_go);
      return OK;
}

sub make_passwd_screen {
    my($msg, $request_uri) = @_;
    print header(),
    start_html(-title => 'Change Password', -bgcolor => 'white'),
    h1('Please Change Password');
    print  h2(font({color => 'red'}, "Error: $msg")) if $msg;
    print start_form(-action => script_name()),
    table(
          Tr(td(['Password', password_field(-name => 'password')])),
          Tr(td(['New Password', password_field(-name => 'newpassword1')])),
          Tr(td(['Confirm New Password', password_field(-name =>
'confirmpassword')]))
          ),
              hidden(-name => 'request_uri', -value => $request_uri),
              submit('Change Password'), p(),
              end_form(),
              em('Note: '),
              "Passwords are case sensitive. Passwords sghould be atleast 5
characters in length, and preferably contain a numeral or a special
character.<BR>Your password
        will <B>NOT</B> be displayed as you type it.";
    }


Any help will be appreciated much :-)

thanks.

-Tushar



      
     

Reply via email to