Project

General

Profile

« Previous | Next » 

Revision 8175

Added by Jing Tao over 11 years ago

add a new subroutine to create a temporary account.

View differences:

src/perl/ldapweb.cgi
268 268
              'initchangepass'    => \&handleInitialChangePassword,
269 269
              'resetpass'         => \&handleResetPassword,
270 270
              'initresetpass'     => \&handleInitialResetPassword,
271
              'createtemppass'    => \&createTemporaryAccount,
271 272
             );
272 273

  
273 274
# call the appropriate routine based on the stage
......
862 863
}
863 864

  
864 865
#
866
# Create a temporary account for a user and send an email with a link which can click for the
867
# verification. This is used to protect the ldap server against spams.
868
#
869
sub createTemporaryAccount {
870
    my $allParams = shift;
871
    #my $org = $query->param('o'); 
872
    my $org = 'LTER';
873
    my $ou = $query-param('ou');
874
    my $uid = $query->param('uid');
875
    
876
    #to see if the organizaton exist
877
    my $tmpSearchBase = 'dc=tmp,' . $authBase;
878
     
879
    print "Content-type: text/html\n\n";
880

  
881

  
882
    # Search LDAP for matching entries that already exist
883
    my $filter = "(o" 
884
                  . "=" . $org .
885
                 ")";
886

  
887
    my @attrs = ['o', 'ou' ];
888
    my $found = searchDirectory($ldapurl, $tmpSearchBase, $filter, \@attrs);
889

  
890
    if($found) {
891
      print "ldap server ". $ldapurl;
892
      print "sesarch base" . $tmpSearchBase;
893
      print "find the organization " . $org;
894
    } else {
895
      print "ldap server ". $ldapurl;
896
      print "sesarch base " . $tmpSearchBase;
897
      print "not find the organization " . $org;
898
    }
899
    
900
    #$query->param('o','tmp');
901
    #createAccount($allParams);
902
    #$query->param('o',$org);
903
    #constrct url
904
    #my $link =
905
    #print "Content-type: text/html\n\n";
906
    #print $query->param('o');
907
}
908

  
909
#
865 910
# Bind to LDAP and create a new account using the information provided
866 911
# by the user
867 912
#

Also available in: Unified diff