Diff for /loncom/auth/lonauth.pm between versions 1.109 and 1.111

version 1.109, 2010/08/25 16:34:32 version 1.111, 2011/02/24 23:37:50
Line 82  sub success { Line 82  sub success {
         my $now=time;          my $now=time;
         my $then=$env{'user.login.time'};          my $then=$env{'user.login.time'};
         my $refresh=$env{'user.refresh.time'};          my $refresh=$env{'user.refresh.time'};
           my $update=$env{'user.update.time'};
           if (!$update) {
               $update = $then;
           }
         if (exists($env{$envkey})) {          if (exists($env{$envkey})) {
             my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus);              my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus);
             &Apache::lonnet::role_status($envkey,$then,$refresh,$now,\$role,\$where,              &Apache::lonnet::role_status($envkey,$update,$refresh,$now,\$role,\$where,
                                          \$trolecode,\$tstatus,\$tstart,\$tend);                                           \$trolecode,\$tstatus,\$tstart,\$tend);
             if ($tstatus eq 'is') {              if ($tstatus eq 'is') {
                 $destination  .= ($destination =~ /\?/) ? '&' : '?';                  $destination  .= ($destination =~ /\?/) ? '&' : '?';
Line 111  sub success { Line 115  sub success {
             $destination .= '&destinationurl='.$destsymb;              $destination .= '&destinationurl='.$destsymb;
         }          }
     }      }
       if ($destination =~ m{^/adm/roles}) {
           $destination  .= ($destination =~ /\?/) ? '&' : '?';
           $destination .= 'source=login';
       }
   
     my $windowinfo = Apache::lonhtmlcommon::scripttag('self.name="loncapaclient";');      my $windowinfo = Apache::lonhtmlcommon::scripttag('self.name="loncapaclient";');
     my $header = '<meta HTTP-EQUIV="Refresh" CONTENT="0; url='.$destination.'" />';      my $header = '<meta HTTP-EQUIV="Refresh" CONTENT="0; url='.$destination.'" />';
Line 352  sub handler { Line 360  sub handler {
             &Apache::lonnet::get_dom('configuration',['usercreation'],$form{'udom'});              &Apache::lonnet::get_dom('configuration',['usercreation'],$form{'udom'});
         if (grep(/^login$/,@cancreate)) {          if (grep(/^login$/,@cancreate)) {
             my $domdesc = &Apache::lonnet::domain($form{'udom'},'description');              my $domdesc = &Apache::lonnet::domain($form{'udom'},'description');
             &check_can_host($r,\%form,'no_account_on_host',$domdesc);              unless (&check_can_host($r,\%form,'no_account_on_host',$domdesc)) {
                   return OK;
               }
             my $start_page =               my $start_page = 
                 &Apache::loncommon::start_page('Create a user account in LON-CAPA');                  &Apache::loncommon::start_page('Create a user account in LON-CAPA');
             my $lonhost = $r->dir_config('lonHostID');              my $lonhost = $r->dir_config('lonHostID');
Line 404  sub handler { Line 414  sub handler {
  }   }
     }      }
   
     &check_can_host($r,\%form,$authhost);      unless (&check_can_host($r,\%form,$authhost)) {
           return OK;
       }
   
     if ($r->dir_config("lonBalancer") eq 'yes') {      if ($r->dir_config("lonBalancer") eq 'yes') {
  &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,   &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,
  \%form);   \%form);
         my ($otherserver) = &Apache::lonnet::choose_server($form{'udom'});          my ($otherserver) = &Apache::lonnet::choose_server($form{'udom'});
  $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl);   $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl);
           return OK;
     } else {      } else {
 # ------------------------------------------------------- Do the load balancing  # ------------------------------------------------------- Do the load balancing
   
Line 432  sub handler { Line 445  sub handler {
                 &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',                  &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',
                          undef,\%form);                           undef,\%form);
                 $r->internal_redirect('/adm/switchserver?otherserver='.$unloaded.'&origurl='.$firsturl);                  $r->internal_redirect('/adm/switchserver?otherserver='.$unloaded.'&origurl='.$firsturl);
                   return OK;
             }              }
         }          }
         &success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,undef,          &success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,undef,
                  \%form);                   \%form);
           return OK;
     }      }
     return OK;  
 }  }
   
 sub check_can_host {  sub check_can_host {
Line 492  sub check_can_host { Line 506  sub check_can_host {
                           '<p>'.&mt('Currently a LON-CAPA server is not available within the [_1] domain for you to log-in to, to create an account.',$domdesc).'</p>'.                            '<p>'.&mt('Currently a LON-CAPA server is not available within the [_1] domain for you to log-in to, to create an account.',$domdesc).'</p>'.
                           &Apache::loncommon::end_page());                            &Apache::loncommon::end_page());
             }              }
             return OK;  
         } else {          } else {
             &success($r,$form->{'uname'},$udom,$authhost,'noredirect',undef,              &success($r,$form->{'uname'},$udom,$authhost,'noredirect',undef,
                      $form);                       $form);
Line 500  sub check_can_host { Line 513  sub check_can_host {
             $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver);              $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver);
         }          }
     }      }
       return $canhost;
 }  }
   
 1;  1;

Removed from v.1.109  
changed lines
  Added in v.1.111


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