Project

General

Profile

« Previous | Next » 

Revision 2414

Added by sgarg over 19 years ago

Added new actions so that error message is not shown the first time resetPassword and changePasswords are called. Also fixed a bug where $cfg was not being passed to genericHeader.tmpl

View differences:

src/perl/ldapweb.cgi
108 108
              'register'          => \&handleRegister,
109 109
              'registerconfirmed' => \&handleRegisterConfirmed,
110 110
              'changepass'        => \&handleChangePassword,
111
              'initchangepass'    => \&handleInitialChangePassword,
111 112
              'simplesearch'      => \&handleSimpleSearch,
112 113
              'initaddentry'      => \&handleInitAddEntry,
113 114
              'addentry'          => \&handleAddEntry,
114 115
              'initmodifyentry'   => \&handleInitModifyEntry,
115 116
              'modifyentry'       => \&handleModifyEntry,
116 117
              'resetpass'         => \&handleResetPassword,
118
              'initresetpass'     => \&handleInitialResetPassword,
117 119
             );
118

  
119 120
# call the appropriate routine based on the stage
120 121
if ( $stages{$stage} ) {
121 122
  $stages{$stage}->();
......
337 338
}
338 339

  
339 340
#
341
# change a user's password upon request - no input params
342
# only display chagepass template without any error
343
#
344
sub handleInitialChangePassword {
345
    print "Content-type: text/html\n\n";
346

  
347
    my $allParams = { 'test' => "1", };
348
    my $errorMessage = "";
349
    my $templateVars = { stage => "changepass",
350
                         cfg => $cfg,
351
                         allParams => $allParams,
352
                         errorMessage => $errorMessage };
353
    $$templateVars{'orgList'} = \@orglist;
354
    $template->process( "@defaultHeader@", $templateVars);
355
    $template->process( "@defaultChangePass@", $templateVars);
356
    $template->process( "@defaultFooter@", $templateVars);
357
    exit(0);
358
}
359

  
360
#
340 361
# reset a user's password upon request
341 362
#
342 363
sub handleResetPassword {
......
423 444
}
424 445

  
425 446
#
447
# reset a user's password upon request- no initial params
448
# only display resetpass template without any error
449
#
450
sub handleInitialResetPassword {
451
    print "Content-type: text/html\n\n";
452
    my $errorMessage = "";
453
    my $allParams = { 'test' => "1", };
454
    my $templateVars = { stage => "resetpass",
455
                         cfg => $cfg,
456
                         allParams => $allParams,
457
                         errorMessage => $errorMessage };
458
    $$templateVars{'orgList'} = \@orglist;
459
    $template->process( "@defaultHeader@", $templateVars);
460
    $template->process( "@defaultResetPass@", $templateVars);
461
    $template->process( "@defaultFooter@", $templateVars);
462
    exit(0);
463
}
464

  
465
#
426 466
# Construct a random string to use for a newly reset password
427 467
#
428 468
sub getRandomPassword {
......
740 780
                                 allParams => $allParams,
741 781
                                 errorMessage => $result->error };
742 782
	    $$templateVars{'orgList'} = \@orglist;
743
            $template->process( "@defaultHeader@");
783
            $template->process( "@defaultHeader@", $templateVars);
744 784
            $template->process( "@registerFailed@", $templateVars);
745 785
            $templateVars    = { stage => "register",
746 786
                                 cfg => $cfg,
747 787
                                 allParams => $allParams };
748 788
	    $$templateVars{'orgList'} = \@orglist;
749 789
            $template->process( "@register@", $templateVars);
750
            $template->process( "@defaultFooter@");
790
            $template->process( "@defaultFooter@", $templateVars);
751 791
        } else {
752
            $template->process( "@defaultHeader@");
753
            $template->process( "@registerSuccess@");
754
            $template->process( "@defaultFooter@");
792
	    my $templateVars    = { cfg => $cfg };
793
            $template->process( "@defaultHeader@", $templateVars);
794
            $template->process( "@registerSuccess@", $templateVars);
795
            $template->process( "@defaultFooter@", $templateVars);
755 796
        }
756 797

  
757 798
        $ldap->unbind;   # take down session

Also available in: Unified diff