--- loncom/auth/lonlogin.pm 2006/11/01 21:27:50 1.82 +++ loncom/auth/lonlogin.pm 2007/03/08 01:58:48 1.89 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.82 2006/11/01 21:27:50 www Exp $ +# $Id: lonlogin.pm,v 1.89 2007/03/08 01:58:48 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -40,17 +40,6 @@ use Apache::migrateuser(); use lib '/home/httpd/lib/perl/'; use LONCAPA; - -sub additional_machine_domains { - my @domains; - open(my $fh,"<".$Apache::lonnet::perlvar{'lonTabDir'}.'/expected_domains.tab'); - while( my $line = <$fh>) { - $line =~ s/\s//g; - push(@domains,$line); - } - return @domains; -} - sub handler { my $r = shift; @@ -84,8 +73,7 @@ sub handler { my $lonid=$cookies{'lonID'}; my $cookie; if ($lonid) { - my $handle=$lonid->value; - $handle=~s/\W//g; + my $handle=&LONCAPA::clean_handle($lonid->value); my $lonidsdir=$r->dir_config('lonIDsDir'); if (-e "$lonidsdir/$handle.id") { # Is there an existing token file? @@ -138,14 +126,9 @@ ENDFAILED } my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':'.$port_to_use. $r->dir_config('lonIconsURL'); - my $domain = $r->dir_config('lonDefDomain'); - my $testdomain=(split(/\./,$ENV{'HTTP_HOST'}))[0]; - foreach my $posdom (&Apache::lonnet::current_machine_domains(), - &additional_machine_domains()) { - if (lc($posdom) eq lc($testdomain)) { $domain=$posdom; } - } + my $domain = &Apache::lonnet::default_login_domain(); if (($env{'form.domain'}) && - ($Apache::lonnet::domaindescription{$env{'form.domain'}})) { + (&Apache::lonnet::domain($env{'form.domain'},'description'))) { $domain=$env{'form.domain'}; } my $role = $r->dir_config('lonRole'); @@ -155,7 +138,7 @@ ENDFAILED my $include = $r->dir_config('lonIncludes'); my $expire = $r->dir_config('lonExpire'); my $version = $r->dir_config('lonVersion'); - my $host_name = $Apache::lonnet::hostname{$lonhost}; + my $host_name = &Apache::lonnet::hostname($lonhost); # --------------------------------------------- Default values for login fields @@ -217,33 +200,36 @@ ENDFAILED my $last; foreach my $hostid (sort { - $Apache::lonnet::hostname{$a} cmp - $Apache::lonnet::hostname{$b}; + &Apache::lonnet::hostname($a) cmp + &Apache::lonnet::hostname($b); } keys(%Apache::lonnet::spareid)) { next if ($hostid eq $lonhost); - next if ($last eq $Apache::lonnet::hostname{$hostid}); + my $hostname = &Apache::lonnet::hostname($hostid); + next if ($last eq $hostname); $spares.='
'. - $Apache::lonnet::hostname{$hostid}.''. + $hostname.''. ' (preferred)'.$/; - $last=$Apache::lonnet::hostname{$hostid}; + $last=$hostname; } $spares.= '
'; + my %all_hostnames = &Apache::lonnet::all_hostnames(); foreach my $hostid (sort { - $Apache::lonnet::hostname{$a} cmp - $Apache::lonnet::hostname{$b}; + &Apache::lonnet::hostname($a) cmp + &Apache::lonnet::hostname($b); } - keys(%Apache::lonnet::hostname)) { + keys(%all_hostnames)) { next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid}); - next if ($last eq $Apache::lonnet::hostname{$hostid}); + my $hostname = &Apache::lonnet::hostname($hostid); + next if ($last eq $hostname); $spares.='
'. - $Apache::lonnet::hostname{$hostid}.''; - $last=$Apache::lonnet::hostname{$hostid}; + $hostname.''; + $last=$hostname; } $r->print(< @@ -302,15 +288,19 @@ my %lt=&Apache::lonlocal::texthash( 'perc' => 'percent', 'load' => 'Load', 'userload' => 'User Load', - 'about' => 'aboutlon.gif', - 'access' => 'accessbutton.gif', + 'about' => 'About LON-CAPA', + 'access' => 'Accessibility Options', + 'catalog' => 'Course Catalog', 'auth' => 'userauthentication.gif', 'log' => 'Log in', - 'help' => 'Help', + 'help' => 'Log-in Help', 'serv' => 'Server', - 'helpdesk' => 'Contact Helpdesk'); + 'helpdesk' => 'Contact Helpdesk', + 'forgotpw' => 'Forgot password?'); # -------------------------------------------------- Change password field name my $now=time; + my $forgotpw = &forgotpwdisplay(%lt); + my $loginhelp = &loginhelpdisplay(%lt); # ---------------------------------------------------------- Serve rest of page $r->print(< - + - - Accessibility Options -
- About LON-CAPA + + + + + + + + + + + + + + + + + +
 $lt{'access'}
 $lt{'about'}
 $lt{'catalog'}
 
- @@ -487,12 +490,18 @@ ENDNOOPT -    $lt{'help'} +  
+ + + $loginhelp + $forgotpw + + @@ -603,7 +612,7 @@ sub contactdisplay { $showhelpdesk = 1; } if ($showhelpdesk) { - $contactblock .= '   '.$$lt{'helpdesk'}.'
'; + $contactblock .= '   '.$lt->{'helpdesk'}.'
'; my $thisurl = &escape('/adm/login'); $$helpdeskscript = <<"ENDSCRIPT";