[LON-CAPA-cvs] cvs: loncom /auth lonlogin.pm
raeburn
raeburn@source.lon-capa.org
Sat, 11 Jun 2011 18:21:07 -0000
raeburn Sat Jun 11 18:21:07 2011 EDT
Modified files:
/loncom/auth lonlogin.pm
Log:
- Check for "no_such_host" response when storing logtoken.
- Only display advice to log-in into another server, if they
other servers are available.
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.147 loncom/auth/lonlogin.pm:1.148
--- loncom/auth/lonlogin.pm:1.147 Thu Mar 3 06:37:30 2011
+++ loncom/auth/lonlogin.pm Sat Jun 11 18:21:07 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Login Screen
#
-# $Id: lonlogin.pm,v 1.147 2011/03/03 06:37:30 raeburn Exp $
+# $Id: lonlogin.pm,v 1.148 2011/06/11 18:21:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -200,9 +200,13 @@
'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
@@ -213,7 +217,7 @@
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.='<br /><font size="+1"><a href="http://'.
$hostname.
'/adm/login?domain='.$authdomain.'">'.
@@ -221,7 +225,9 @@
' '.&mt('(preferred)').'</font>'.$/;
$last=$hostname;
}
-$spares.= '<br />';
+ if ($spares) {
+ $spares.= '<br />';
+ }
my %all_hostnames = &Apache::lonnet::all_hostnames();
foreach my $hostid (sort
{
@@ -231,7 +237,7 @@
keys(%all_hostnames)) {
next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
my $hostname = &Apache::lonnet::hostname($hostid);
- next if ($last eq $hostname);
+ next if (($last eq $hostname) || ($hostname eq ''));
$spares.='<br /><a href="http://'.
$hostname.
'/adm/login?domain='.$authdomain.'">'.
@@ -246,12 +252,15 @@
.'<body bgcolor="#FFFFFF">'
.'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
.'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
- .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>'
- .'<p>'.&mt('Please attempt to login to one of the following servers:').'</p>'
- .$spares
- .'</body>'
+ .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>');
+ if ($spares) {
+ $r->print('<p>'.&mt('Please attempt to login to one of the following servers:')
+ .'</p>'
+ .$spares);
+ }
+ $r->print('</body>'
.'</html>'
-);
+ );
return OK;
}