Diff for /loncom/auth/lonauth.pm between versions 1.101.8.6 and 1.101.8.7

version 1.101.8.6, 2011/06/10 01:30:33 version 1.101.8.7, 2011/09/27 20:18:45
Line 276  sub handler { Line 276  sub handler {
     my $tmpinfo=Apache::lonnet::reply('tmpget:'.$form{'logtoken'},      my $tmpinfo=Apache::lonnet::reply('tmpget:'.$form{'logtoken'},
                                       $form{'serverid'});                                        $form{'serverid'});
   
     if (($tmpinfo=~/^error/) || ($tmpinfo eq 'con_lost')) {      if (($tmpinfo=~/^error/) || ($tmpinfo eq 'con_lost') ||
          ($tmpinfo eq 'no_such_host')) {
  &failed($r,'Information needed to verify your login information is missing, inaccessible or expired.',\%form);   &failed($r,'Information needed to verify your login information is missing, inaccessible or expired.',\%form);
         return OK;          return OK;
     } else {      } else {
Line 417  sub handler { Line 418  sub handler {
  }   }
     }      }
   
     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,  
  \%form);  
         my $otherserver = &Apache::lonnet::spareserver(30000,undef,1,$form{'udom'});          my $otherserver = &Apache::lonnet::spareserver(30000,undef,1,$form{'udom'});
  $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl);          if (!$otherserver) {
               ($otherserver) = &Apache::lonnet::choose_server($form{'udom'});
           }
           if ($otherserver) {
               &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,
                        \%form);
               $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl);
           } else {
               $r->print(&noswitch());
           }
         return OK;          return OK;
     } else {      } else {
           if (!&check_can_host($r,\%form,$authhost)) {
               my ($otherserver) = &Apache::lonnet::choose_server($form{'udom'});
               if ($otherserver) {
                   &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,
                            \%form);
                   $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl);
               } else {
                   $r->print(&noswitch());
               }
               return OK;
           }
 # ------------------------------------------------------- Do the load balancing  # ------------------------------------------------------- Do the load balancing
   
 # ---------------------------------------------------------- Determine own load  # ---------------------------------------------------------- Determine own load
Line 444  sub handler { Line 459  sub handler {
 # ---------------------------------------------------------- Are we overloaded?  # ---------------------------------------------------------- Are we overloaded?
         if ((($userloadpercent>100.0)||($loadpercent>100.0))) {          if ((($userloadpercent>100.0)||($loadpercent>100.0))) {
             my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent,1,$form{'udom'});              my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent,1,$form{'udom'});
               if (!$unloaded) {
                   ($unloaded) = &Apache::lonnet::choose_server($form{'udom'});
               }
             if ($unloaded) {              if ($unloaded) {
                 &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',                  &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',
                          undef,\%form);                           undef,\%form);
Line 489  sub check_can_host { Line 507  sub check_can_host {
     }      }
     unless ($canhost) {      unless ($canhost) {
         if ($authhost eq 'no_account_on_host') {          if ($authhost eq 'no_account_on_host') {
             my ($login_host,$hostname) = &Apache::lonnet::choose_server($udom);              my $checkloginvia = 1;
               my ($login_host,$hostname) =
                   &Apache::lonnet::choose_server($udom,$checkloginvia);
             &Apache::loncommon::content_type($r,'text/html');              &Apache::loncommon::content_type($r,'text/html');
             $r->send_http_header;              $r->send_http_header;
             if ($login_host ne '') {              if ($login_host ne '') {
Line 519  sub check_can_host { Line 539  sub check_can_host {
     return $canhost;      return $canhost;
 }  }
   
   sub noswitch {
       my $result = &Apache::loncommon::start_page('Access to LON-CAPA unavailable').
                    '<h3>'.&mt('Session unavailable').'</h3>'.
                    &mt('This LON-CAPA server is unable to host your session.').'<br />'.
                    '<p>'.&mt('Currently no other LON-CAPA server is available to host your session either.').'</p>'.
                    &Apache::loncommon::end_page();
       return $result;
   }
   
 1;  1;
 __END__  __END__
   

Removed from v.1.101.8.6  
changed lines
  Added in v.1.101.8.7


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