[LON-CAPA-cvs] cvs: loncom / startup.pl /interface loncreateuser.pm

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 28 Dec 2004 22:30:29 -0000


matthew		Tue Dec 28 17:30:29 2004 EDT

  Modified files:              
    /loncom	startup.pl 
    /loncom/interface	loncreateuser.pm 
  Log:
  loncreateuser.pm: Made BEGIN block a subroutine which is called prior to use
  of any of the variables initialized in the subroutine.
  startup.pl: Added loncreateuser.pm
  
  
Index: loncom/startup.pl
diff -u loncom/startup.pl:1.18 loncom/startup.pl:1.19
--- loncom/startup.pl:1.18	Fri Jun 18 20:38:45 2004
+++ loncom/startup.pl	Tue Dec 28 17:30:28 2004
@@ -120,7 +120,7 @@
 use Apache::structuretags();
 use Apache::portfolio();
 # can't include this one due to the way it does it's BEGIN
-#use Apache::loncreateuser();
+use Apache::loncreateuser();
 1;
 __END__
 
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.93 loncom/interface/loncreateuser.pm:1.94
--- loncom/interface/loncreateuser.pm:1.93	Tue Dec 28 11:10:24 2004
+++ loncom/interface/loncreateuser.pm	Tue Dec 28 17:30:28 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.93 2004/12/28 16:10:24 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.94 2004/12/28 22:30:28 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -73,10 +73,9 @@
 my $authformfsys;
 my $authformloc;
 
-BEGIN {
-    $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;
-    my $krbdefdom=$1;
-    $krbdefdom=~tr/a-z/A-Z/;
+sub initialize_authen_forms {
+    my ($krbdefdom)=( $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/);
+    $krbdefdom= uc($krbdefdom);
     my %param = ( formname => 'document.cu',
                   kerb_def_dom => $krbdefdom 
                   );
@@ -397,6 +396,7 @@
                     'lg'   => "Login Data"
 				       );
 	my $genhelp=&Apache::loncommon::help_open_topic('Generation');
+        &initialize_authen_forms();
 	$r->print(<<ENDNEWUSER);
 $dochead
 <h1>$lt{'cnu'}</h1>
@@ -674,6 +674,7 @@
 		$currentauth=~/^localauth:/
 		) { # bad authentication scheme
 	    if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) {
+                &initialize_authen_forms();
 		my %lt=&Apache::lonlocal::texthash(
                                'err'   => "ERROR",
 			       'uuas'  => "This user has an unrecognized authentication scheme",
@@ -715,6 +716,7 @@
         } else { # Authentication type is valid
 	    my $authformcurrent='';
 	    my $authform_other='';
+            &initialize_authen_forms();
 	    if ($currentauth=~/^krb(4|5):/) {
 		$authformcurrent=$authformkrb;
 		$authform_other="<p>$authformint</p>\n".