--- loncom/auth/lonlogin.pm 2010/09/02 09:24:42 1.145 +++ loncom/auth/lonlogin.pm 2012/08/27 00:52:45 1.152 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.145 2010/09/02 09:24:42 www Exp $ +# $Id: lonlogin.pm,v 1.152 2012/08/27 00:52:45 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -64,7 +64,8 @@ sub handler { # Are we re-routing? - if (-e '/home/httpd/html/lon-status/reroute.txt') { + my $londocroot = $r->dir_config('lonDocRoot'); + if (-e "$londocroot/lon-status/reroute.txt") { &Apache::lonauth::reroute($r); return OK; } @@ -91,7 +92,7 @@ sub handler { } $r->print( $start_page - .'
'.&mt('You are already logged in!').'
' .''.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].', '','','','').'
' .$end_page @@ -151,10 +152,14 @@ sub handler { $loadavg=<$loadfile>; } $loadavg =~ s/\s.*//g; - my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim); - unless ($loadlim) { $loadpercent='---'; } - my $userloadpercent=&Apache::lonnet::userload(); - unless ($uloadlim) { $userloadpercent='---'; } + + my ($loadpercent,$userloadpercent); + if ($loadlim) { + $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim); + } + if ($uloadlim) { + $userloadpercent=&Apache::lonnet::userload(); + } my $firsturl= ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'}); @@ -196,9 +201,13 @@ sub handler { 'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras, $lonhost); -# ------------------- If we cannot talk to ourselves, we are in serious trouble +# -- If we cannot talk to ourselves, or hostID does not map to a hostname +# we are in serious trouble - if ($logtoken eq 'con_lost') { + if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) { + if ($logtoken eq 'no_such_host') { + &Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab'); + } my $spares=''; my $last; foreach my $hostid (sort @@ -209,7 +218,7 @@ sub handler { keys(%Apache::lonnet::spareid)) { next if ($hostid eq $lonhost); my $hostname = &Apache::lonnet::hostname($hostid); - next if ($last eq $hostname); + next if (($last eq $hostname) || ($hostname eq '')); $spares.=''.&mt('Please attempt to login to one of the following servers:').'
' - .$spares - .'' - .'' -); -return OK; -} + .''.&mt('Please attempt to login to one of the following servers:') + .'
' + .$spares); + } + $r->print('' + .'