Project

General

Profile

« Previous | Next » 

Revision 8229

Added by Jing Tao over 11 years ago

Add code to handle the looking up names.

View differences:

ldapweb.cgi
304 304
              'resetpass'         => \&handleResetPassword,
305 305
              'initresetpass'     => \&handleInitialResetPassword,
306 306
              'emailverification' => \&handleEmailVerification,
307
              'lookupname' => \&handleLookupName,
307
              'lookupname'        => \&handleLookupName,
308
              'searchnamesbyemail'=> \&handleSearchNameByEmail,
308 309
             );
309 310

  
310 311
# call the appropriate routine based on the stage
......
335 336
}
336 337

  
337 338

  
339
#
340
# Initialize a form for a user to request the account name associated with an email address
341
#
342
sub handleLookupName {
343
    
344
    print "Content-type: text/html\n\n";
345
    # process the template files:
346
    fullTemplate(['lookupName']); 
347
    exit();
348
}
338 349

  
339 350
#
340 351
# Handle the user's request to look up account names with a specified email address.
341 352
# This relates to "Forget your user name"
342 353
#
343
sub handleLookupName {
354
sub handleSearchNameByEmail{
344 355

  
345 356
    print "Content-type: text/html\n\n";
346 357
   
......
349 360
    if (! paramsAreValid(@requiredParams)) {
350 361
        my $errorMessage = "Required information is missing. " .
351 362
            "Please fill in all required fields and resubmit the form.";
352
        fullTemplate(['lookupname'], { stage => "lookupname",
353
                                     allParams => $allParams,
363
        fullTemplate(['lookupName'], { allParams => $allParams,
354 364
                                     errorMessage => $errorMessage });
355 365
        exit();
356 366
    }
......
380 390
    my $recipient = $query->param('mail');
381 391
    # Send the email message to them
382 392
    my $smtp = Net::SMTP->new($mailhost) or do {  
383
                                                  fullTemplate( ['lookupNameFailed'], {errorMessage => "Our mail server currently is experiencing some difficulties. Please contact " . 
384
                                                  $skinProperties->getProperty("email.recipient") . "." });  
393
                                                  fullTemplate( ['lookupName'], {allParams => $allParams, 
394
                                                                errorMessage => "Our mail server currently is experiencing some difficulties. Please contact " . 
395
                                                                $skinProperties->getProperty("email.recipient") . "." });  
385 396
                                                  exit(0);
386 397
                                               };
387 398
    $smtp->mail($sender);

Also available in: Unified diff