Diff for /loncom/auth/lonauth.pm between versions 1.3 and 1.5

version 1.3, 1999/12/16 20:30:55 version 1.5, 2000/02/29 16:24:00
Line 1 Line 1
 # The LearningOnline Network  # The LearningOnline Network
 # User Authentication Module  # User Authentication Module
 # 5/21/99,5/22,5/25,5/26,5/27,5/29,6/2,6/11,6/14,6/15  # 5/21/99,5/22,5/25,5/26,5/27,5/29,6/2,6/11,6/14,6/15
 # 16/11,12/16 Gerd Kortemeyer  # 16/11,12/16,
   # 1/14,2/24,2/28,2/29 Gerd Kortemeyer
   
 package Apache::lonauth;  package Apache::lonauth;
   
Line 14  use Apache::lonnet(); Line 15  use Apache::lonnet();
 # ------------------------------------------------------------ Successful login  # ------------------------------------------------------------ Successful login
   
 sub success {  sub success {
     my ($r, $lowerurl, $username, $domain, $authhost) = @_;      my ($r, $username, $domain, $authhost) = @_;
     my $lonids=$r->dir_config('lonIDsDir');      my $lonids=$r->dir_config('lonIDsDir');
 # See if old ID present, but overlooked  
   # See if old ID present, if so, remove
     my $cookie;      my $cookie;
     if ($cookie=<$lonids/$username\_*\_$domain\_$authhost.id>) {      while ($cookie=<$lonids/$username\_*\_$domain\_$authhost.id>) {
  $cookie=~s/\.id//;   unlink($cookie);
         $cookie=~s/$lonids\///;      }
     } else {  
         my $now=time;  # Give them a new cookie
         $cookie="$username\_$now\_$domain\_$authhost";  
         my $userroles=Apache::lonnet::reply(      my $now=time;
     "dump:$domain:$username:roles",      $cookie="$username\_$now\_$domain\_$authhost";
                                             $authhost);  
         $userroles=~s/&/\n/g;  # Initialize roles
         {  
       my $userroles=Apache::lonnet::rolesinit($domain,$username,$authhost);
   
   # Write first profile
   
          {
     my $idf=Apache::File->new(">$lonids/$cookie.id");      my $idf=Apache::File->new(">$lonids/$cookie.id");
             print $idf "username=$username\n";              print $idf "user.name=$username\n";
             print $idf "userdomain=$domain\n";              print $idf "user.domain=$domain\n";
             print $idf "userhome=$authhost\n";              print $idf "user.home=$authhost\n";
             print $idf "$userroles\n";              if ($userroles ne '') { print $idf "$userroles" };
         }          }
     }  
   # ------------------------------------------------------------ Get cookie ready
   
     $cookie="lonID=$cookie; path=/";      $cookie="lonID=$cookie; path=/";
   
   # ------------------------------------------------- Output for successful login
   
     $r->send_cgi_header(<<ENDHEADER);      $r->send_cgi_header(<<ENDHEADER);
 Content-type: text/html  Content-type: text/html
 Set-cookie: $cookie  Set-cookie: $cookie
Line 45  ENDHEADER Line 57  ENDHEADER
     $r->print(<<ENDSUCCESS);      $r->print(<<ENDSUCCESS);
 <html>  <html>
 <head>  <head>
 <title>Successful Login to the LearningOnline Network</title>  <title>Successful Login to the LearningOnline Network with CAPA</title>
 </head>  </head>
 <frameset rows="80,*" border=0>  <frameset rows="80,*" border=0>
 <frame scrolling="no" name="loncontrol" src="/adm/menu">  <frame scrolling="no" name="loncontrol" src="/adm/menu">
 <frame name="loncontent" src="$lowerurl">  <frame name="loncontent" src="/adm/roles">
 </frameset>  </frameset>
 </html>  </html>
 ENDSUCCESS  ENDSUCCESS
Line 66  ENDFHEADER Line 78  ENDFHEADER
     $r->print(<<ENDFAILED);      $r->print(<<ENDFAILED);
 <html>  <html>
 <head>  <head>
 <title>Unsuccessful Login to the LearningOnline Network</title>  <title>Unsuccessful Login to the LearningOnline Network with CAPA</title>
 </head>  </head>
 <html>  <html>
 <body bgcolor="#FFFFFF">  <body bgcolor="#FFFFFF">
 <h1>Sorry ...</h1>  <h1>Sorry ...</h1>
 <h2>$message to use the Learning<i>Online</i> Network</h2>  <h2>$message to use the Learning<i>Online</i> Network with CAPA</h2>
 </body>  </body>
 </html>  </html>
 ENDFAILED  ENDFAILED
Line 120  sub handler { Line 132  sub handler {
     if (!$lonurl) { failed($r,'Cookies need to be activated'); return OK; }      if (!$lonurl) { failed($r,'Cookies need to be activated'); return OK; }
     my $lowerurl=$lonurl->value;      my $lowerurl=$lonurl->value;
   
     success($r,$lowerurl,$FORM{'uname'},$FORM{'udom'},$authhost);      success($r,$FORM{'uname'},$FORM{'udom'},$authhost);
     return OK;      return OK;
 }  }
   

Removed from v.1.3  
changed lines
  Added in v.1.5


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