--- loncom/auth/lonlogin.pm 2003/01/31 21:51:36 1.29 +++ loncom/auth/lonlogin.pm 2003/02/04 16:03:25 1.31 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.29 2003/01/31 21:51:36 www Exp $ +# $Id: lonlogin.pm,v 1.31 2003/02/04 16:03:25 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,7 +50,7 @@ sub handler { &Apache::loncommon::get_unprocessed_cgi - ($ENV{'QUERY_STRING'},['interface']); + ($ENV{'QUERY_STRING'},['interface','username','domain','firsturl']); $ENV{'form.interface'}=~s/\W//g; @@ -67,6 +67,12 @@ sub handler { my $tabdir = $r->dir_config('lonTabDir'); my $include = $r->dir_config('lonIncludes'); +# --------------------------------------------- Default values for login fields + + my $authusername=($ENV{'form.username'}?$ENV{'form.username'}:''); + my $authdomain=($ENV{'form.domain'}?$ENV{'form.domain'}:$domain); + +# ---------------------------------------------------------- Determine own load my $loadavg; { my $loadfile=Apache::File->new('/proc/loadavg'); @@ -75,8 +81,10 @@ sub handler { $loadavg =~ s/\s.*//g; my $loadpercent=100*$loadavg/$loadlim; +# ------------------------------------------------------- Do the load balancing my $otherserver='http://'.$ENV{'SERVER_NAME'}; - my $firsturl=$ENV{'request.firsturl'}; + my $firsturl= + ($ENV{'request.firsturl'}?$ENV{'request.firsturl'}:$ENV{'form.firsturl'}); # ---------------------------------------- Are we access server and overloaded? if (($role eq 'access') && ($loadpercent>100.0)) { $otherserver=Apache::lonnet::spareserver($loadpercent); @@ -102,9 +110,41 @@ sub handler { my $uextkey=hex($ukey); if ($uextkey>2147483647) { $uextkey-=4294967296; } +# -------------------------------------------------------- Store away log token my $logtoken=Apache::lonnet::reply( 'tmpput:'.$ukey.$lkey.'&'.$firsturl, $lonhost); + +# ------------------- If we cannot talk to ourselves, we are in serious trouble + + if ($logtoken eq 'con_lost') { + my $spares=''; + foreach (keys %Apache::lonnet::hostname) { + if ($_ ne $lonhost) { + $spares.='
'. + $Apache::lonnet::hostname{$_}.''; + if ($Apache::lonnet::spareid{$_}) { + $spares.=' (preferred)'; + } + } + } + $r->print(< +The LearningOnline Network with CAPA + + +

This LON-CAPA server is temporarily not available for login

+

Please attempt to login to one of the following servers:

$spares +

If the problem persists, please contact $servadm.

+ + +ENDTROUBLE + return OK; + } + +# ----------------------------------------------- Apparently we are in business + my $domainlogo=&Apache::loncommon::domainlogo(); # --------------------------------------------------- Print login screen header $r->print(<User Authentication
   User Name: -
+
   Password: @@ -247,7 +287,7 @@ ENDTOP    Domain: - +    Help