Diff for /loncom/interface/loncreateuser.pm between versions 1.30 and 1.31

version 1.30, 2002/04/18 20:16:43 version 1.31, 2002/04/22 15:26:46
Line 68  BEGIN { Line 68  BEGIN {
     $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;      $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;
     my $krbdefdom=$1;      my $krbdefdom=$1;
     $krbdefdom=~tr/a-z/A-Z/;      $krbdefdom=~tr/a-z/A-Z/;
     $authformnop=(<<END);      my %param = ( formname => 'document.cu',
 <p>                    kerb_def_dom => $krbdefdom 
 <input type="radio" name="login" value="nochange" checked="checked"                    );
        onclick="changed_radio('nochange',document.cu);">      $loginscript  = &Apache::loncommon::authform_header(%param);
 Do not change login data      $generalrule  = &Apache::loncommon::authform_authorwarning(%param);
 </p>      $authformnop  = &Apache::loncommon::authform_nochange(%param);
 END      $authformkrb  = &Apache::loncommon::authform_kerberos(%param);
     $authformkrb=(<<END);      $authformint  = &Apache::loncommon::authform_internal(%param);
 <p>      $authformfsys = &Apache::loncommon::authform_filesystem(%param);
 <input type="radio" name="login" value="krb"       $authformloc  = &Apache::loncommon::authform_local(%param);
        onclick="changed_radio('krb',document.cu);">  
 Kerberos authenticated with domain  
 <input type="text" size="10" name="krbarg"   
        onclick="changed_text('krb',document.cu);"  
        onchange="changed_text('krb',document.cu);">  
 </p>  
 END  
     $authformint=(<<END);  
 <p>  
 <input type="radio" name="login" value="int"   
        onclick="changed_radio('int',document.cu);">   
 Internally authenticated (with initial password   
 <input type="text" size="10" name="intarg"   
        onclick="changed_text('int',document.cu);"  
        onchange="changed_text('int',document.cu);">  
 </p>  
 END  
     $authformfsys=(<<END);  
 <p>  
 <input type="radio" name="login" value="fsys"   
        onclick="changed_radio('fsys',document.cu);">   
 Filesystem authenticated (with initial password   
 <input type="text" size="10" name="fsysarg"  
        onclick="changed_text('fsys',document.cu);"  
        onchange="changed_text('fsys',document.cu);">  
 </p>  
 END  
     $authformloc=(<<END);  
 <p>  
 <input type="radio" name="login" value="loc"  
        onclick="changed_radio('loc',document.cu);">   
 Local Authentication with argument  
 <input type="text" size="10" name="locarg"   
        onclick="changed_text('loc',document.cu);"  
        onchange="changed_text('loc',document.cu);">  
 </p>  
 END  
     $loginscript=(<<ENDLOGINSCRIPT);  
 <script>  
   
 var authvalues = new Object();  
 authvalues.names = new Array('krbarg','intarg','fsysarg','locarg');  
 authvalues.defaults = new Array('MSU.EDU','','','');  
   
 function changed_radio(choice,currentform) {  
     var choicearg = choice + 'arg';  
     if (currentform.elements[choicearg].value == '') {  
         clear(currentform,authvalues.names);  
         for (var i=0; i<authvalues.names.length; i++) {  
             if (authvalues.names[i] == choicearg) {  
                 currentform.elements[choicearg].value = authvalues.defaults[i];  
             }  
         }  
     }  
 }  
   
 function changed_text(choice,currentform) {  
     var choicearg = choice + 'arg';  
     if (currentform.elements[choicearg].value !='') {  
         // clear the other values  
         var keep = currentform.elements[choicearg].value;  
         clear(currentform,authvalues.names);  
         currentform.elements[choicearg].value = keep;  
         // validate our value  
         if (choice == 'krb') {  
             currentform.elements[choicearg].value = keep.toUpperCase();  
         }  
         // check the appropriate checkbox  
         set_checked('login',choice,currentform);  
     }   
 }  
   
 function clear(currentform,names) {  
     for (var i=0; i< currentform.elements.length; i++) {  
         for (var j = 0; j< names.length; j++) {  
             if (currentform.elements[i].name == names[j]) {  
                 currentform.elements[i].value = '';  
             }  
         }  
     }  
 }  
   
 function set_checked(name,choice,currentform) {  
     for (var i=0; i< currentform.elements.length; i++) {  
         if (currentform.elements[i].name == name) {  
             if (currentform.elements[i].value == choice) {  
                 currentform.elements[i].checked =true;  
             }  
         }  
     }  
 }  
   
 </script>  
 ENDLOGINSCRIPT  
     $generalrule=<<END;  
 <p>  
 <i>As a general rule, only authors or co-authors should be filesystem  
 authenticated (which allows access to the server filesystem).</i>  
 </p>  
 END  
 }  }
   
 # =================================================================== Phase one  # =================================================================== Phase one
Line 212  sub phase_two { Line 112  sub phase_two {
     $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;      $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;
     my $krbdefdom=$1;      my $krbdefdom=$1;
     $krbdefdom=~tr/a-z/A-Z/;      $krbdefdom=~tr/a-z/A-Z/;
       my %param = ( formname => 'document.cu',
                     kerb_def_dom => $krbdefdom 
                     );
       $loginscript  = &Apache::loncommon::authform_header(%param);
   
     my $defdom=$ENV{'user.domain'};      my $defdom=$ENV{'user.domain'};
   
Line 221  sub phase_two { Line 125  sub phase_two {
 <html>  <html>
 <head>  <head>
 <title>The LearningOnline Network with CAPA</title>  <title>The LearningOnline Network with CAPA</title>
 <script>  <script type="text/javascript" language="Javascript">
   
     function pclose() {      function pclose() {
         parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",          parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
Line 283  $dochead Line 187  $dochead
 <h1>Create New User</h1>  <h1>Create New User</h1>
 $forminfo  $forminfo
 <h2>New user "$ccuname" in domain $ccdomain</h2>  <h2>New user "$ccuname" in domain $ccdomain</h2>
   <script type="text/javascript" language="Javascript">
 $loginscript  $loginscript
   </script>
 <input type='hidden' name='makeuser' value='1' />  <input type='hidden' name='makeuser' value='1' />
 <h3>Personal Data</h3>  <h3>Personal Data</h3>
 <p>  <p>
Line 301  ID/Student Number <input type='text' nam Line 207  ID/Student Number <input type='text' nam
 Home Server: <select name="hserver" size="1"> $home_server_list </select>  Home Server: <select name="hserver" size="1"> $home_server_list </select>
 <hr />  <hr />
 <h3>Login Data</h3>  <h3>Login Data</h3>
 $generalrule  <p>$generalrule </p>
 $authformkrb  <p>$authformkrb </p>
 $authformint  <p>$authformint </p>
 $authformfsys  <p>$authformfsys</p>
 $authformloc  <p>$authformloc </p>
 ENDNEWUSER  ENDNEWUSER
     } else { # user already exists      } else { # user already exists
  $r->print(<<ENDCHANGEUSER);   $r->print(<<ENDCHANGEUSER);
Line 410  END Line 316  END
  if ($currentauth=~/^krb4:/) {   if ($currentauth=~/^krb4:/) {
     $currentauth=~/^krb4:(.*)/;      $currentauth=~/^krb4:(.*)/;
     my $krbdefdom2=$1;      my $krbdefdom2=$1;
     $loginscript=~s/vf\.krbdom\.value='.*?';/vf.krbdom.value='$krbdefdom2';/;              my %param = ( formname => 'document.cu',
                             kerb_def_dom => $krbdefdom 
                             );
               $loginscript  = &Apache::loncommon::authform_header(%param);
  }   }
  # Check for a bad authentication type   # Check for a bad authentication type
         unless ($currentauth=~/^krb4:/ or          unless ($currentauth=~/^krb4:/ or
Line 421  END Line 330  END
     if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) {      if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) {
  $r->print(<<ENDBADAUTH);   $r->print(<<ENDBADAUTH);
 <hr />  <hr />
   <script type="text/javascript" language="Javascript">
 $loginscript  $loginscript
   </script>
 <font color='#ff0000'>ERROR:</font>  <font color='#ff0000'>ERROR:</font>
 This user has an unrecognized authentication scheme ($currentauth).  This user has an unrecognized authentication scheme ($currentauth).
 Please specify login data below.  Please specify login data below.
 <h3>Login Data</h3>  <h3>Login Data</h3>
 $generalrule  <p>$generalrule</p>
 $authformkrb  <p>$authformkrb</p>
 $authformint  <p>$authformint</p>
 $authformfsys  <p>$authformfsys</p>
 $authformloc  <p>$authformloc</p>
 ENDBADAUTH  ENDBADAUTH
             } else {               } else { 
                 # This user is not allowed to modify the users                   # This user is not allowed to modify the users 
                 # authentication scheme, so just notify them of the problem                  # authentication scheme, so just notify them of the problem
  $r->print(<<ENDBADAUTH);   $r->print(<<ENDBADAUTH);
 <hr />  <hr />
   <script type="text/javascript" language="Javascript">
 $loginscript  $loginscript
   </script>
 <font color="#ff0000"> ERROR: </font>  <font color="#ff0000"> ERROR: </font>
 This user has an unrecognized authentication scheme ($currentauth).  This user has an unrecognized authentication scheme ($currentauth).
 Please alert a domain coordinator of this situation.  Please alert a domain coordinator of this situation.
Line 449  ENDBADAUTH Line 362  ENDBADAUTH
     my $authform_other='';      my $authform_other='';
     if ($currentauth=~/^krb4:/) {      if ($currentauth=~/^krb4:/) {
  $authformcurrent=$authformkrb;   $authformcurrent=$authformkrb;
  $authform_other=$authformint.$authformfsys.$authformloc;   $authform_other="<p>$authformint</p>\n".
  # embarrassing script hack here                      "<p>$authformfsys</p><p>$authformloc</p>";
  $loginscript=~s/login\[3\]/login\[4\]/; # loc  
  $loginscript=~s/login\[2\]/login\[3\]/; # fsys  
  $loginscript=~s/login\[1\]/login\[2\]/; # int  
  $loginscript=~s/login\[0\]/login\[1\]/; # krb4  
     }      }
     elsif ($currentauth=~/^internal:/) {      elsif ($currentauth=~/^internal:/) {
  $authformcurrent=$authformint;   $authformcurrent=$authformint;
  $authform_other=$authformkrb.$authformfsys.$authformloc;   $authform_other="<p>$authformkrb</p>".
  # embarrassing script hack here                      "<p>$authformfsys</p><p>$authformloc</p>";
  $loginscript=~s/login\[3\]/login\[4\]/; # loc  
  $loginscript=~s/login\[2\]/login\[3\]/; # fsys  
  $loginscript=~s/login\[1\]/login\[1\]/; # int  
  $loginscript=~s/login\[0\]/login\[2\]/; # krb4  
     }      }
     elsif ($currentauth=~/^unix:/) {      elsif ($currentauth=~/^unix:/) {
  $authformcurrent=$authformfsys;   $authformcurrent=$authformfsys;
  $authform_other=$authformkrb.$authformint.$authformloc;   $authform_other="<p>$authformkrb</p>".
  # embarrassing script hack here                      "<p>$authformint</p><p>$authformloc;</p>";
  $loginscript=~s/login\[3\]/login\[4\]/; # loc  
  $loginscript=~s/login\[1\]/login\[3\]/; # int  
  $loginscript=~s/login\[2\]/login\[1\]/; # fsys  
  $loginscript=~s/login\[0\]/login\[2\]/; # krb4  
     }      }
     elsif ($currentauth=~/^localauth:/) {      elsif ($currentauth=~/^localauth:/) {
  $authformcurrent=$authformloc;   $authformcurrent=$authformloc;
  $authform_other=$authformkrb.$authformint.$authformfsys;   $authform_other="<p>$authformkrb</p>".
  # embarrassing script hack here                      "<p>$authformint</p><p>$authformfsys</p>";
  $loginscript=~s/login\[3\]/login\[loc\]/; # loc  
  $loginscript=~s/login\[2\]/login\[4\]/; # fsys  
  $loginscript=~s/login\[1\]/login\[3\]/; # int  
  $loginscript=~s/login\[0\]/login\[2\]/; # krb4  
  $loginscript=~s/login\[loc\]/login\[1\]/; # loc  
     }      }
     $authformcurrent=<<ENDCURRENTAUTH;      $authformcurrent=<<ENDCURRENTAUTH;
 <table border='1'>  <table border='1'>
Line 498  ENDCURRENTAUTH Line 394  ENDCURRENTAUTH
  # Current user has login modification privileges   # Current user has login modification privileges
  $r->print(<<ENDOTHERAUTHS);   $r->print(<<ENDOTHERAUTHS);
 <hr />  <hr />
   <script type="text/javascript" language="Javascript">
 $loginscript  $loginscript
   </script>
 <h3>Change Current Login Data</h3>  <h3>Change Current Login Data</h3>
 $generalrule  <p>$generalrule</p>
 $authformnop  <p>$authformnop</p>
 $authformcurrent  <p>$authformcurrent</p>
 <h3>Enter New Login Data</h3>  <h3>Enter New Login Data</h3>
 $authform_other  $authform_other
 ENDOTHERAUTHS  ENDOTHERAUTHS
Line 685  ENDMODIFYUSERHEAD Line 583  ENDMODIFYUSERHEAD
  # Only allow authentification modification if the person has authority   # Only allow authentification modification if the person has authority
  if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) {   if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) {
     $r->print('Modifying authentication: '.      $r->print('Modifying authentication: '.
   &Apache::lonnet::modifyuserauth(                        &Apache::lonnet::modifyuserauth(
        $ENV{'form.ccdomain'},$ENV{'form.ccuname'},         $ENV{'form.ccdomain'},$ENV{'form.ccuname'},
                        $amode,$genpwd));                         $amode,$genpwd));
             $r->print('<br>Home server: '.&Apache::lonnet::homeserver              $r->print('<br>Home server: '.&Apache::lonnet::homeserver

Removed from v.1.30  
changed lines
  Added in v.1.31


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>