Diff for /loncom/auth/lonlogin.pm between versions 1.158.2.8 and 1.188

version 1.158.2.8, 2019/08/01 14:21:37 version 1.188, 2021/10/06 19:28:55
Line 1 Line 1
 # The LearningOnline Network  # The LearningOnline Network
 # Login Screen  # Login Screen
 #  #
 # $Id$  # $Id$
 #  #
 # Copyright Michigan State University Board of Trustees  # Copyright Michigan State University Board of Trustees
 #  #
 # This file is part of the LearningOnline Network with CAPA (LON-CAPA).  # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
 #  #
 # LON-CAPA is free software; you can redistribute it and/or modify  # LON-CAPA is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by  # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or  # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.  # (at your option) any later version.
 #  #
 # LON-CAPA is distributed in the hope that it will be useful,  # LON-CAPA is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of  # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.  # GNU General Public License for more details.
 #  #
 # You should have received a copy of the GNU General Public License  # You should have received a copy of the GNU General Public License
 # along with LON-CAPA; if not, write to the Free Software  # along with LON-CAPA; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #  #
 # /home/httpd/html/adm/gpl.txt  # /home/httpd/html/adm/gpl.txt
 #  #
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
   
 package Apache::lonlogin;  package Apache::lonlogin;
   
 use strict;  use strict;
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use Apache::File ();  use Apache::File ();
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonauth();  use Apache::lonauth();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::migrateuser();  use Apache::migrateuser();
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
 use CGI::Cookie();  use URI::Escape;
    use HTML::Entities();
 sub handler {  use CGI::Cookie();
     my $r = shift;   
   sub handler {
     &Apache::loncommon::get_unprocessed_cgi      my $r = shift;
  (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},  
       $ENV{'REDIRECT_QUERY_STRING'}),      &Apache::loncommon::get_unprocessed_cgi
  ['interface','username','domain','firsturl','localpath','localres',   (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
   'token','role','symb','iptoken','btoken']);        $ENV{'REDIRECT_QUERY_STRING'}),
     if (!defined($env{'form.firsturl'})) {   ['interface','username','domain','firsturl','localpath','localres',
         &Apache::lonacc::get_posted_cgi($r,['firsturl']);    'token','role','symb','iptoken','btoken','ltoken','linkkey','saml']);
     }      if (!defined($env{'form.firsturl'})) {
           &Apache::lonacc::get_posted_cgi($r,['firsturl']);
 # -- check if they are a migrating user      }
     if (defined($env{'form.token'})) {      if (!defined($env{'form.firsturl'})) {
  return &Apache::migrateuser::handler($r);          if ($ENV{'REDIRECT_URL'} =~ m{^/+tiny/+$LONCAPA::match_domain/+\w+$}) {
     }              $env{'form.firsturl'} = $ENV{'REDIRECT_URL'};
           }
 # For "public user" - remove any exising "public" cookie, as user really wants to log-in      }
     my ($handle,$lonidsdir,$expirepub,$userdom);      if (($env{'form.firsturl'} =~ m{^/+tiny/+$LONCAPA::match_domain/+\w+$}) &&
     $lonidsdir=$r->dir_config('lonIDsDir');          (!$env{'form.ltoken'}) && (!$env{'form.linkkey'})) {
     unless ($r->header_only) {          &Apache::lonacc::get_posted_cgi($r,['linkkey']);
         $handle = &Apache::lonnet::check_for_valid_session($r,'lonID',undef,\$userdom);      }
         if ($handle ne '') {  
             if ($handle=~/^publicuser\_/) {  # -- check if they are a migrating user
                 unlink($r->dir_config('lonIDsDir')."/$handle.id");      if (defined($env{'form.token'})) {
                 undef($handle);   return &Apache::migrateuser::handler($r);
                 undef($userdom);      }
                 $expirepub = 1;  
             }  # For "public user" - remove any exising "public" cookie, as user really wants to log-in
         }      my ($handle,$lonidsdir,$expirepub,$userdom);
     }      $lonidsdir=$r->dir_config('lonIDsDir');
       unless ($r->header_only) {
     &Apache::loncommon::no_cache($r);          $handle = &Apache::lonnet::check_for_valid_session($r,'lonID',undef,\$userdom);
     &Apache::lonlocal::get_language_handle($r);          if ($handle ne '') {
     &Apache::loncommon::content_type($r,'text/html');              if ($handle=~/^publicuser\_/) {
     if ($expirepub) {                  unlink($r->dir_config('lonIDsDir')."/$handle.id");
         my $c = new CGI::Cookie(-name    => 'lonID',                  undef($handle);
                                 -value   => '',                  undef($userdom);
                                 -expires => '-10y',);                  $expirepub = 1;
         $r->header_out('Set-cookie' => $c);              }
     } elsif (($handle eq '') && ($userdom ne '')) {          }
         my $c = new CGI::Cookie(-name    => 'lonID',      }
                                 -value   => '',  
                                 -expires => '-10y',);      &Apache::loncommon::no_cache($r);
         $r->headers_out->add('Set-cookie' => $c);      &Apache::lonlocal::get_language_handle($r);
     }      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      if ($expirepub) {
     return OK if $r->header_only;          my $c = new CGI::Cookie(-name    => 'lonPubID',
                                   -value   => '',
                                   -expires => '-10y',);
 # Are we re-routing?          $r->header_out('Set-cookie' => $c);
     my $londocroot = $r->dir_config('lonDocRoot');       } elsif (($handle eq '') && ($userdom ne '')) {
     if (-e "$londocroot/lon-status/reroute.txt") {          my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
  &Apache::lonauth::reroute($r);          foreach my $name (keys(%cookies)) {
  return OK;              next unless ($name =~ /^lon(|S|Link|Pub)ID$/);
     }              my $c = new CGI::Cookie(-name    => $name,
                                       -value   => '',
     my $lonhost = $r->dir_config('lonHostID');                                      -expires => '-10y',);
     $env{'form.firsturl'} =~ s/(`)/'/g;              $r->headers_out->add('Set-cookie' => $c);
           }
 # Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer)      }
       $r->send_http_header;
     my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r,1);      return OK if $r->header_only;
     if ($found_server) {  
         my $hostname = &Apache::lonnet::hostname($found_server);  
         if ($hostname ne '') {  # Are we re-routing?
             my $protocol = $Apache::lonnet::protocol{$found_server};      my $londocroot = $r->dir_config('lonDocRoot');
             $protocol = 'http' if ($protocol ne 'https');      if (-e "$londocroot/lon-status/reroute.txt") {
             my $dest = '/adm/roles';   &Apache::lonauth::reroute($r);
             if ($env{'form.firsturl'} ne '') {   return OK;
                 $dest = $env{'form.firsturl'};      }
             }  
             my %info = (      my $lonhost = $r->dir_config('lonHostID');
                          balcookie => $lonhost.':'.$balancer_cookie,  
                        );  # Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer)
             my $balancer_token = &Apache::lonnet::tmpput(\%info,$found_server);  
             if ($balancer_token) {      my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r,1);
                 $dest .=  (($dest=~/\?/)?'&;':'?') . 'btoken='.$balancer_token;      if ($found_server) {
             }          my $hostname = &Apache::lonnet::hostname($found_server);
             my $url = $protocol.'://'.$hostname.$dest;          if ($hostname ne '') {
             my $start_page =              my $protocol = $Apache::lonnet::protocol{$found_server};
                 &Apache::loncommon::start_page('Switching Server ...',undef,              $protocol = 'http' if ($protocol ne 'https');
                                                {'redirect'       => [0,$url],});              my $dest = '/adm/roles';
             my $end_page   = &Apache::loncommon::end_page();              if ($env{'form.firsturl'} ne '') {
             $r->print($start_page.$end_page);                  if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
             return OK;                      $dest = &uri_escape_utf8($env{'form.firsturl'});
         }                  } else {
     }                      $dest = &uri_escape($env{'form.firsturl'});
                   }
 #                  $dest = &HTML::Entities::encode($dest,"'");
 # Check if a LON-CAPA load balancer sent user here because user's browser sent              }
 # it a balancer cookie for an active session on this server.              my %info = (
 #                           balcookie => $lonhost.':'.$balancer_cookie,
                          );
     my $balcookie;              if ($env{'form.ltoken'}) {
     if ($env{'form.btoken'}) {                  my %link_info = &Apache::lonnet::tmpget($env{'form.ltoken'});
         my %info = &Apache::lonnet::tmpget($env{'form.btoken'});                  if ($link_info{'linkprot'}) {
         $balcookie = $info{'balcookie'};                      $info{'linkprot'} = $link_info{'linkprot'};
         &Apache::lonnet::tmpdel($env{'form.btoken'});                  }
         delete($env{'form.btoken'});                  &Apache::lonnet::tmpdel($env{'form.ltoken'});
     }                  delete($env{'form.ltoken'});
               } elsif ($env{'form.linkkey'}) {
 #                  $info{'linkkey'} = $env{'form.linkkey'};
 # If browser sent an old cookie for which the session file had been removed                  delete($env{'form.linkkey'});
 # check if configuration for user's domain has a portal URL set.  If so              }
 # switch user's log-in to the portal.              my $balancer_token = &Apache::lonnet::tmpput(\%info,$found_server);
 #              if ($balancer_token) {
                   $dest .=  (($dest=~/\?/)?'&':'?') . 'btoken='.$balancer_token;
     if (($handle eq '') && ($userdom ne '')) {              }
         my %domdefaults = &Apache::lonnet::get_domain_defaults($userdom);              unless ($found_server eq $lonhost) {
         if ($domdefaults{'portal_def'} =~ /^https?\:/) {                  my $alias = &Apache::lonnet::use_proxy_alias($r,$found_server);
             my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,                  $hostname = $alias if ($alias ne '');
                                           {'redirect' => [0,$domdefaults{'portal_def'}],});              }
             my $end_page   = &Apache::loncommon::end_page();              my $url = $protocol.'://'.$hostname.$dest;
             $r->print($start_page.$end_page);              my $start_page =
             return OK;                  &Apache::loncommon::start_page('Switching Server ...',undef,
         }                                                 {'redirect'       => [0,$url],});
     }              my $end_page   = &Apache::loncommon::end_page();
               $r->print($start_page.$end_page);
     $env{'form.firsturl'} =~ s/(`)/'/g;              return OK;
           }
 # -------------------------------- Prevent users from attempting to login twice      }
     if ($handle ne '') {  
         &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);  #
  my $start_page =   # Check if a LON-CAPA load balancer sent user here because user's browser sent
     &Apache::loncommon::start_page('Already logged in');  # it a balancer cookie for an active session on this server.
  my $end_page =   #
     &Apache::loncommon::end_page();  
         my $dest = '/adm/roles';      my ($balcookie,$linkprot,$linkkey);
         if ($env{'form.firsturl'} ne '') {      if ($env{'form.btoken'}) {
             $dest = $env{'form.firsturl'};           my %info = &Apache::lonnet::tmpget($env{'form.btoken'});
         }          $balcookie = $info{'balcookie'};
  $r->print(          if ($balcookie) {
               $start_page              if ($info{'linkprot'}) {
              .'<p class="LC_warning">'.&mt('You are already logged in!').'</p>'                  $linkprot = $info{'linkprot'};
              .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',              } elsif ($info{'linkkey'}) {
               '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'                  $linkkey = $info{'linkkey'};
              .$end_page              }
              );          }    
         return OK;          &Apache::lonnet::tmpdel($env{'form.btoken'});
     }          delete($env{'form.btoken'});
       }
 # ---------------------------------------------------- No valid token, continue  
   #
 # ---------------------------- Not possible to really login to domain "public"  # If browser sent an old cookie for which the session file had been removed
     if ($env{'form.domain'} eq 'public') {  # check if configuration for user's domain has a portal URL set.  If so
  $env{'form.domain'}='';  # switch user's log-in to the portal.
  $env{'form.username'}='';  #
     }  
       if (($handle eq '') && ($userdom ne '')) {
 # ------ Is this page requested because /adm/migrateuser detected an IP change?          my %domdefaults = &Apache::lonnet::get_domain_defaults($userdom);
     my %sessiondata;          if ($domdefaults{'portal_def'} =~ /^https?\:/) {
     if ($env{'form.iptoken'}) {              my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
         %sessiondata = &Apache::lonnet::tmpget($env{'form.iptoken'});                                            {'redirect' => [0,$domdefaults{'portal_def'}],});
         unless ($sessiondata{'sessionserver'}) {              my $end_page   = &Apache::loncommon::end_page();
             my $delete = &Apache::lonnet::tmpdel($env{'form.iptoken'});              $r->print($start_page.$end_page);
             delete($env{'form.iptoken'});              return OK;
         }          }
     }      }
 # ----------------------------------------------------------- Process Interface  
     $env{'form.interface'}=~s/\W//g;  # -------------------------------- Prevent users from attempting to login twice
       if ($handle ne '') {
     (undef,undef,undef,undef,undef,undef,my $clientmobile) =          &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
         &Apache::loncommon::decode_user_agent();   my $start_page =
       &Apache::loncommon::start_page('Already logged in');
     my $iconpath=    my $end_page =
  &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));      &Apache::loncommon::end_page();
           my $dest = '/adm/roles';
     my $domain = &Apache::lonnet::default_login_domain();          if ($env{'form.firsturl'} ne '') {
     my $defdom = $domain;              if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
     if ($lonhost ne '') {                  $dest = &uri_escape_utf8($env{'form.firsturl'});
         unless ($sessiondata{'sessionserver'}) {              } else {
             my $redirect = &check_loginvia($domain,$lonhost,$lonidsdir,$balcookie);                  $dest = &uri_escape($env{'form.firsturl'});
             if ($redirect) {              }
                 $r->print($redirect);              $dest = &HTML::Entities::encode($dest,"'");
                 return OK;          }
             }          if (($env{'form.ltoken'}) || ($linkprot)) {
         }              unless ($linkprot) {
     }                  my %info = &Apache::lonnet::tmpget($env{'form.ltoken'});
                   $linkprot = $info{'linkprot'};
     if (($sessiondata{'domain'}) &&                  my $delete = &Apache::lonnet::tmpdel($env{'form.ltoken'});
         (&Apache::lonnet::domain($sessiondata{'domain'},'description'))) {                  delete($env{'form.ltoken'});
         $domain=$sessiondata{'domain'};              }
     } elsif (($env{'form.domain'}) &&               if ($linkprot) {
  (&Apache::lonnet::domain($env{'form.domain'},'description'))) {                  my ($linkprotector,$deeplink) = split(/:/,$linkprot,2);
  $domain=$env{'form.domain'};                  if ($env{'user.linkprotector'}) {
     }                      my @protectors = split(/,/,$env{'user.linkprotector'});
                       unless (grep(/^\Q$linkprotector\E$/,@protectors)) {
     my $role    = $r->dir_config('lonRole');                          push(@protectors,$linkprotector);
     my $loadlim = $r->dir_config('lonLoadLim');                          @protectors = sort { $a <=> $b } @protectors;
     my $uloadlim= $r->dir_config('lonUserLoadLim');                          &Apache::lonnet::appenv({'user.linkprotector' => join(',',@protectors)});
     my $servadm = $r->dir_config('lonAdmEMail');                      }
     my $tabdir  = $r->dir_config('lonTabDir');                  } else {
     my $include = $r->dir_config('lonIncludes');                      &Apache::lonnet::appenv({'user.linkprotector' => $linkprotector });
     my $expire  = $r->dir_config('lonExpire');                  }
     my $version = $r->dir_config('lonVersion');                  if ($env{'user.linkproturi'}) {
     my $host_name = &Apache::lonnet::hostname($lonhost);                      my @proturis = split(/,/,$env{'user.linkproturi'});
                       unless (grep(/^\Q$deeplink\E$/,@proturis)) {
 # --------------------------------------------- Default values for login fields                          push(@proturis,$deeplink);
                               @proturis = sort @proturis;
     my ($authusername,$authdomain);                          &Apache::lonnet::appenv({'user.linkproturi' => join(',',@proturis)});
     if ($sessiondata{'username'}) {                      }
         $authusername=$sessiondata{'username'};                  } else {
     } else {                      &Apache::lonnet::appenv({'user.linkproturi' => $deeplink});
         $env{'form.username'} = &Apache::loncommon::cleanup_html($env{'form.username'});                  }
         $authusername=($env{'form.username'}?$env{'form.username'}:'');              }
     }          } elsif (($env{'form.linkkey'}) || ($linkkey)) {
     if ($sessiondata{'domain'}) {              if ($env{'form.firsturl'} =~ m{^/tiny/$match_domain/\w+$}) {
         $authdomain=$sessiondata{'domain'};                  if ($linkkey eq '') {
     } else {                      $linkkey = $env{'form.linkkey'};
         $env{'form.domain'} = &Apache::loncommon::cleanup_html($env{'form.domain'});                  }
         $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);                  if ($env{'user.deeplinkkey'}) {
     }                      my @linkkeys = split(/,/,$env{'user.deeplinkkey'});
                       unless (grep(/^\Q$linkkey\E$/,@linkkeys)) {
 # ---------------------------------------------------------- Determine own load                          push(@linkkeys,$linkkey);
     my $loadavg;                          &Apache::lonnet::appenv({'user.deeplinkkey' => join(',',sort(@linkkeys))});  
     {                      }
  my $loadfile=Apache::File->new('/proc/loadavg');                  } else {
  $loadavg=<$loadfile>;                      &Apache::lonnet::appenv({'user.deeplinkkey' => $linkkey});
     }                  }
     $loadavg =~ s/\s.*//g;                  my $deeplink = $env{'form.firsturl'};
                   if ($env{'user.keyedlinkuri'}) {
     my ($loadpercent,$userloadpercent);                      my @keyeduris = split(/,/,$env{'user.keyedlinkuri'});
     if ($loadlim) {                      unless (grep(/^\Q$deeplink\E$/,@keyeduris)) {
         $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);                          push(@keyeduris,$deeplink);
     }                          &Apache::lonnet::appenv({'user.keyedlinkuri' => join(',',sort(@keyeduris))});
     if ($uloadlim) {                      }
         $userloadpercent=&Apache::lonnet::userload();                  } else {
     }                      &Apache::lonnet::appenv({'user.keyedlinkuri' => $deeplink});
                   }
     my $firsturl=              }
     ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});          }
    $r->print(
 # ----------------------------------------------------------- Get announcements                    $start_page
     my $announcements=&Apache::lonnet::getannounce();                   .'<p class="LC_warning">'.&mt('You are already logged in!').'</p>'
 # -------------------------------------------------------- Set login parameters                   .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
                     '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
     my @hexstr=('0','1','2','3','4','5','6','7',                   .$end_page
                 '8','9','a','b','c','d','e','f');                   );
     my $lkey='';          return OK;
     for (0..7) {      }
         $lkey.=$hexstr[rand(15)];  
     }  # ---------------------------------------------------- No valid token, continue
   
     my $ukey='';  # ---------------------------- Not possible to really login to domain "public"
     for (0..7) {      if ($env{'form.domain'} eq 'public') {
         $ukey.=$hexstr[rand(15)];   $env{'form.domain'}='';
     }   $env{'form.username'}='';
       }
     my $lextkey=hex($lkey);  
     if ($lextkey>2147483647) { $lextkey-=4294967296; }  # ------ Is this page requested because /adm/migrateuser detected an IP change?
       my %sessiondata;
     my $uextkey=hex($ukey);      if ($env{'form.iptoken'}) {
     if ($uextkey>2147483647) { $uextkey-=4294967296; }          %sessiondata = &Apache::lonnet::tmpget($env{'form.iptoken'});
           unless ($sessiondata{'sessionserver'}) {
 # -------------------------------------------------------- Store away log token              my $delete = &Apache::lonnet::tmpdel($env{'form.iptoken'});
     my $tokenextras;              delete($env{'form.iptoken'});
     if ($env{'form.role'}) {          }
         $tokenextras = '&role='.&escape($env{'form.role'});      }
     }  # ----------------------------------------------------------- Process Interface
     if ($env{'form.symb'}) {      $env{'form.interface'}=~s/\W//g;
         if (!$tokenextras) {  
             $tokenextras = '&';      (undef,undef,undef,undef,undef,undef,my $clientmobile) =
         }          &Apache::loncommon::decode_user_agent();
         $tokenextras .= '&symb='.&escape($env{'form.symb'});  
     }      my $iconpath=
     if ($env{'form.iptoken'}) {   &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
         if (!$tokenextras) {  
             $tokenextras = '&&';      my $domain = &Apache::lonnet::default_login_domain();
         }      my $defdom = $domain;
         $tokenextras .= '&iptoken='.&escape($env{'form.iptoken'});      if ($lonhost ne '') {
     }          unless ($sessiondata{'sessionserver'}) {
     my $logtoken=Apache::lonnet::reply(              my $redirect = &check_loginvia($domain,$lonhost,$lonidsdir,$balcookie,$linkprot);
        'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,              if ($redirect) {
        $lonhost);                  $r->print($redirect);
                   return OK;
 # -- If we cannot talk to ourselves, or hostID does not map to a hostname              }
 #    we are in serious trouble          }
       }
     if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {  
         if ($logtoken eq 'no_such_host') {      if (($sessiondata{'domain'}) &&
             &Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab');          (&Apache::lonnet::domain($sessiondata{'domain'},'description'))) {
         }          $domain=$sessiondata{'domain'};
         my $spares='';      } elsif (($env{'form.domain'}) &&
  my $last;   (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
         foreach my $hostid (sort   $domain=$env{'form.domain'};
     {      }
  &Apache::lonnet::hostname($a) cmp  
     &Apache::lonnet::hostname($b);      my $role    = $r->dir_config('lonRole');
     }      my $loadlim = $r->dir_config('lonLoadLim');
     keys(%Apache::lonnet::spareid)) {      my $uloadlim= $r->dir_config('lonUserLoadLim');
             next if ($hostid eq $lonhost);      my $servadm = $r->dir_config('lonAdmEMail');
     my $hostname = &Apache::lonnet::hostname($hostid);      my $tabdir  = $r->dir_config('lonTabDir');
     next if (($last eq $hostname) || ($hostname eq ''));      my $include = $r->dir_config('lonIncludes');
             $spares.='<br /><font size="+1"><a href="http://'.      my $expire  = $r->dir_config('lonExpire');
                 $hostname.      my $version = $r->dir_config('lonVersion');
                 '/adm/login?domain='.$authdomain.'">'.      my $host_name = &Apache::lonnet::hostname($lonhost);
                 $hostname.'</a>'.  
                 ' '.&mt('(preferred)').'</font>'.$/;  # --------------------------------------------- Default values for login fields
     $last=$hostname;     
         }      my ($authusername,$authdomain);
         if ($spares) {      if ($sessiondata{'username'}) {
             $spares.= '<br />';          $authusername=$sessiondata{'username'};
         }      } else {
         my %all_hostnames = &Apache::lonnet::all_hostnames();          $env{'form.username'} = &Apache::loncommon::cleanup_html($env{'form.username'});
         foreach my $hostid (sort          $authusername=($env{'form.username'}?$env{'form.username'}:'');
     {      }
  &Apache::lonnet::hostname($a) cmp      if ($sessiondata{'domain'}) {
     &Apache::lonnet::hostname($b);          $authdomain=$sessiondata{'domain'};
     }      } else {
     keys(%all_hostnames)) {          $env{'form.domain'} = &Apache::loncommon::cleanup_html($env{'form.domain'});
             next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});          $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
             my $hostname = &Apache::lonnet::hostname($hostid);      }
             next if (($last eq $hostname) || ($hostname eq ''));  
             $spares.='<br /><a href="http://'.  # ---------------------------------------------------------- Determine own load
              $hostname.      my $loadavg;
              '/adm/login?domain='.$authdomain.'">'.      {
              $hostname.'</a>';   my $loadfile=Apache::File->new('/proc/loadavg');
             $last=$hostname;   $loadavg=<$loadfile>;
          }      }
          $r->print(      $loadavg =~ s/\s.*//g;
    '<html>'  
   .'<head><title>'      my ($loadpercent,$userloadpercent);
   .&mt('The LearningOnline Network with CAPA')      if ($loadlim) {
   .'</title></head>'          $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
   .'<body bgcolor="#FFFFFF">'      }
   .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'      if ($uloadlim) {
   .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'          $userloadpercent=&Apache::lonnet::userload();
   .'<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:')      my $firsturl=
                      .'</p>'      ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
                      .$spares);  
         }  # ----------------------------------------------------------- Get announcements
         $r->print('</body>'      my $announcements=&Apache::lonnet::getannounce();
                  .'</html>'  # -------------------------------------------------------- Set login parameters
         );  
         return OK;      my @hexstr=('0','1','2','3','4','5','6','7',
     }                  '8','9','a','b','c','d','e','f');
       my $lkey='';
 # ----------------------------------------------- Apparently we are in business      for (0..7) {
     $servadm=~s/\,/\<br \/\>/g;          $lkey.=$hexstr[rand(15)];
       }
 # ----------------------------------------------------------- Front page design  
     my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);      my $ukey='';
     my $font=&Apache::loncommon::designparm('login.font',$domain);      for (0..7) {
     my $link=&Apache::loncommon::designparm('login.link',$domain);          $ukey.=$hexstr[rand(15)];
     my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);      }
     my $alink=&Apache::loncommon::designparm('login.alink',$domain);  
     my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);      my $lextkey=hex($lkey);
     my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain);      if ($lextkey>2147483647) { $lextkey-=4294967296; }
     my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain);  
     my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain);      my $uextkey=hex($ukey);
     my $logo=&Apache::loncommon::designparm('login.logo',$domain);      if ($uextkey>2147483647) { $uextkey-=4294967296; }
     my $img=&Apache::loncommon::designparm('login.img',$domain);  
     my $domainlogo=&Apache::loncommon::domainlogo($domain);  # -------------------------------------------------------- Store away log token
     my $showbanner = 1;      my $tokenextras;
     my $showmainlogo = 1;      if ($env{'form.role'}) {
     if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {          $tokenextras = '&role='.&escape($env{'form.role'});
         $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);      }
     }      if ($env{'form.symb'}) {
     if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {          if (!$tokenextras) {
         $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);              $tokenextras = '&';
     }          }
     my $showadminmail;          $tokenextras .= '&symb='.&escape($env{'form.symb'});
     my @possdoms = &Apache::lonnet::current_machine_domains();      }
     if (grep(/^\Q$domain\E$/,@possdoms)) {      if ($env{'form.iptoken'}) {
         $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);          if (!$tokenextras) {
     }              $tokenextras = '&&';
     my $showcoursecat =          }
         &Apache::loncommon::designparm('login.coursecatalog',$domain);          $tokenextras .= '&iptoken='.&escape($env{'form.iptoken'});
     my $shownewuserlink =       }
         &Apache::loncommon::designparm('login.newuser',$domain);      if ($env{'form.ltoken'}) {
     my $showhelpdesk =          my %info = &Apache::lonnet::tmpget($env{'form.ltoken'});
         &Apache::loncommon::designparm('login.helpdesk',$domain);          &Apache::lonnet::tmpdel($env{'form.ltoken'});
     my $now=time;          delete($env{'form.ltoken'});
     my $js = (<<ENDSCRIPT);          if ($info{'linkprot'}) {
               if (!$tokenextras) {
 <script type="text/javascript" language="JavaScript">                  $tokenextras = '&&&';
 // <![CDATA[              }
 function send()              $tokenextras .= '&linkprot='.&escape($info{'linkprot'});
 {          }
 this.document.server.elements.uname.value      } elsif ($env{'form.linkkey'}) {
 =this.document.client.elements.uname.value;          if (!$tokenextras) {
               $tokenextras = '&&&';
 this.document.server.elements.udom.value          }
 =this.document.client.elements.udom.value;          $tokenextras .= '&linkkey='.&escape($env{'form.linkkey'});
       }
 uextkey=this.document.client.elements.uextkey.value;      my $logtoken=Apache::lonnet::reply(
 lextkey=this.document.client.elements.lextkey.value;         'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
 initkeys();         $lonhost);
   
 this.document.server.elements.upass0.value  # -- If we cannot talk to ourselves, or hostID does not map to a hostname
     =getCrypted(this.document.client.elements.upass$now.value);  #    we are in serious trouble
   
 this.document.client.elements.uname.value='';      if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {
 this.document.client.elements.upass$now.value='';          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');
 this.document.server.submit();          }
 return false;          my $spares='';
 }          my (@sparehosts,%spareservers);
           my $sparesref = &Apache::lonnet::this_host_spares($defdom);
 function enableInput() {          if (ref($sparesref) eq 'HASH') {
     this.document.client.elements.upass$now.removeAttribute("readOnly");              foreach my $key (keys(%{$sparesref})) {
     this.document.client.elements.uname.removeAttribute("readOnly");                  if (ref($sparesref->{$key}) eq 'ARRAY') {
     this.document.client.elements.udom.removeAttribute("readOnly");                      my @sorted = sort { &Apache::lonnet::hostname($a) cmp
     return;                                          &Apache::lonnet::hostname($b);
 }                                        } @{$sparesref->{$key}};
                       if (@sorted) {
 // ]]>                          if ($key eq 'primary') {
 </script>                              unshift(@sparehosts,@sorted);
                           } elsif ($key eq 'default') {
 ENDSCRIPT                              push(@sparehosts,@sorted);
                           }
 # --------------------------------------------------- Print login screen header                      }
                   }
     my %add_entries = (              }
        bgcolor      => "$mainbg",          }
        text         => "$font",          foreach my $hostid (@sparehosts) {
        link         => "$link",              next if ($hostid eq $lonhost);
        vlink        => "$vlink",      my $hostname = &Apache::lonnet::hostname($hostid);
        alink        => "$alink",      next if (($hostname eq '') || ($spareservers{$hostname}));
                onload       => 'javascript:enableInput();',);              $spareservers{$hostname} = 1;
               my $protocol = $Apache::lonnet::protocol{$hostid};
     my ($lonhost_in_use,$headextra,$headextra_exempt,@hosts,%defaultdomconf);              $protocol = 'http' if ($protocol ne 'https');
     @hosts = &Apache::lonnet::current_machine_ids();              $spares.='<br /><span style="font-size: larger;"><a href="'.$protocol.'://'.
     $lonhost_in_use = $lonhost;                  $hostname.
     if (@hosts > 1) {                  '/adm/login?domain='.$authdomain.'">'.
         foreach my $hostid (@hosts) {                  $hostname.'</a>'.
             if (&Apache::lonnet::host_domain($hostid) eq $defdom) {                  ' '.&mt('(preferred)').'</span>'.$/;
                 $lonhost_in_use = $hostid;          }
                 last;          if ($spares) {
             }              $spares.= '<br />';
         }          }
     }          my %all_hostnames = &Apache::lonnet::all_hostnames();
     %defaultdomconf = &Apache::loncommon::get_domainconf($defdom);          foreach my $hostid (sort
     $headextra = $defaultdomconf{$defdom.'.login.headtag_'.$lonhost_in_use};      {
     $headextra_exempt = $defaultdomconf{$domain.'.login.headtag_exempt_'.$lonhost_in_use};   &Apache::lonnet::hostname($a) cmp
     if ($headextra) {      &Apache::lonnet::hostname($b);
         my $omitextra;      }
         if ($headextra_exempt ne '') {      keys(%all_hostnames)) {
             my @exempt = split(',',$headextra_exempt);              next if ($hostid eq $lonhost);
             my $ip = $ENV{'REMOTE_ADDR'};              my $hostname = &Apache::lonnet::hostname($hostid);
             if (grep(/^\Q$ip\E$/,@exempt)) {              next if (($hostname eq '') || ($spareservers{$hostname}));
                 $omitextra = 1;              $spareservers{$hostname} = 1;
             }              my $protocol = $Apache::lonnet::protocol{$hostid};
         }              $protocol = 'http' if ($protocol ne 'https');
         unless ($omitextra) {              $spares.='<br /><a href="'.$protocol.'://'.
             my $confname = $defdom.'-domainconfig';               $hostname.
             if ($headextra =~ m{^\Q/res/$defdom/$confname/login/headtag/$lonhost_in_use/\E}) {               '/adm/login?domain='.$authdomain.'">'.
                 my $extra = &Apache::lonnet::getfile(&Apache::lonnet::filelocation("",$headextra));               $hostname.'</a>';
                 unless ($extra eq '-1') {           }
                     $js .= "\n".$extra."\n";           $r->print(
                 }     '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
             }    .'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'
         }    .'<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>'
     }    .&mt('The LearningOnline Network with CAPA')
     .'</title></head>'
     $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,    .'<body bgcolor="#FFFFFF">'
        { 'redirect'       => [$expire,'/adm/roles'],     .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
  'add_entries' => \%add_entries,    .'<img src="/adm/lonKaputt/lonlogo_broken.gif" alt="broken icon" align="right" />'
  'only_body'   => 1,}));    .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>');
           if ($spares) {
 # ----------------------------------------------------------------------- Texts              $r->print('<p>'.&mt('Please attempt to login to one of the following servers:')
                        .'</p>'
     my %lt=&Apache::lonlocal::texthash(                       .$spares);
           'un'       => 'Username',          }
           'pw'       => 'Password',          $r->print('</body>'
           'dom'      => 'Domain',                   .'</html>'
           'perc'     => 'percent',          );
           'load'     => 'Server Load',          return OK;
           'userload' => 'User Load',      }
           'catalog'  => 'Course/Community Catalog',  
           'log'      => 'Log in',  # ----------------------------------------------- Apparently we are in business
           'help'     => 'Log-in Help',      $servadm=~s/\,/\<br \/\>/g;
           'serv'     => 'Server',  
           'servadm'  => 'Server Administration',  # ----------------------------------------------------------- Front page design
           'helpdesk' => 'Contact Helpdesk',      my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);
           'forgotpw' => 'Forgot password?',      my $font=&Apache::loncommon::designparm('login.font',$domain);
           'newuser'  => 'New User?',      my $link=&Apache::loncommon::designparm('login.link',$domain);
        );      my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);
 # -------------------------------------------------- Change password field name      my $alink=&Apache::loncommon::designparm('login.alink',$domain);
       my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);
     my $forgotpw = &forgotpwdisplay(%lt);      my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain);
     $forgotpw .= '<br />' if $forgotpw;      my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain);
     my $loginhelp = &Apache::lonauth::loginhelpdisplay($authdomain);      my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain);
     if ($loginhelp) {      my $logo=&Apache::loncommon::designparm('login.logo',$domain);
         $loginhelp = '<a href="'.$loginhelp.'">'.$lt{'help'}.'</a><br />';      my $img=&Apache::loncommon::designparm('login.img',$domain);
     }      my $domainlogo=&Apache::loncommon::domainlogo($domain);
       my $showbanner = 1;
 # ---------------------------------------------------- Serve out DES JavaScript      my $showmainlogo = 1;
     {      if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
     my $jsh=Apache::File->new($include."/londes.js");          $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
     $r->print(<$jsh>);      }
     }      if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
 # ---------------------------------------------------------- Serve rest of page          $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
       }
     $r->print(      my $showadminmail;
     '<div class="LC_Box"'      my @possdoms = &Apache::lonnet::current_machine_domains();
    .' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'      if (grep(/^\Q$domain\E$/,@possdoms)) {
 );          $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
       }
     $r->print(<<ENDSERVERFORM);      my $showcoursecat =
 <form name="server" action="/adm/authenticate" method="post" target="_top">          &Apache::loncommon::designparm('login.coursecatalog',$domain);
    <input type="hidden" name="logtoken" value="$logtoken" />      my $shownewuserlink =
    <input type="hidden" name="serverid" value="$lonhost" />          &Apache::loncommon::designparm('login.newuser',$domain);
    <input type="hidden" name="uname" value="" />      my $showhelpdesk =
    <input type="hidden" name="upass0" value="" />          &Apache::loncommon::designparm('login.helpdesk',$domain);
    <input type="hidden" name="udom" value="" />      my $now=time;
    <input type="hidden" name="localpath" value="$env{'form.localpath'}" />      my $js = (<<ENDSCRIPT);
    <input type="hidden" name="localres" value="$env{'form.localres'}" />  
   </form>  <script type="text/javascript" language="JavaScript">
 ENDSERVERFORM  // <![CDATA[
     my $coursecatalog;  function send()
     if (($showcoursecat eq '') || ($showcoursecat)) {  {
         $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';  this.document.server.elements.uname.value
     }  =this.document.client.elements.uname.value;
     my $newuserlink;  
     if ($shownewuserlink) {  this.document.server.elements.udom.value
         $newuserlink = &newuser_link($lt{'newuser'}).'<br />';  =this.document.client.elements.udom.value;
     }  
     my $logintitle =  uextkey=this.document.client.elements.uextkey.value;
         '<h2 class="LC_hcell"'  lextkey=this.document.client.elements.lextkey.value;
        .' style="background:'.$loginbox_header_bgcol.';'  initkeys();
        .' color:'.$loginbox_header_textcol.'">'  
        .$lt{'log'}  if(this.document.server.action.substr(0,5) === 'http:'){
        .'</h2>';      this.document.server.elements.upass0.value
           =getCrypted(this.document.client.elements.upass$now.value);
     my $noscript_warning='<noscript><span class="LC_warning"><b>'  } else {
                         .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')      this.document.server.elements.upass0.value
                         .'</b></span></noscript>';          =this.document.client.elements.upass$now.value;
     my $helpdeskscript;  }
     my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,  
                                        $authdomain,\$helpdeskscript,  this.document.client.elements.uname.value='';
                                        $showhelpdesk,\@possdoms);  this.document.client.elements.upass$now.value='';
   
     my $mobileargs;  this.document.server.submit();
     if ($clientmobile) {  return false;
         $mobileargs = 'autocapitalize="off" autocorrect="off"';   }
     }  
     my $loginform=(<<LFORM);  function enableInput() {
 <form name="client" action="" onsubmit="return(send())">      this.document.client.elements.upass$now.removeAttribute("readOnly");
   <input type="hidden" name="lextkey" value="$lextkey" />      this.document.client.elements.uname.removeAttribute("readOnly");
   <input type="hidden" name="uextkey" value="$uextkey" />      this.document.client.elements.udom.removeAttribute("readOnly");
   <b><label for="uname">$lt{'un'}</label>:</b><br />      return;
   <input type="text" name="uname" id="uname" size="15" value="$authusername" readonly="readonly" $mobileargs /><br />  }
   <b><label for="upass$now">$lt{'pw'}</label>:</b><br />  
   <input type="password" name="upass$now" id="upass$now" size="15" readonly="readonly" /><br />  // ]]>
   <b><label for="udom">$lt{'dom'}</label>:</b><br />  </script>
   <input type="text" name="udom" id="udom" size="15" value="$authdomain" readonly="readonly" $mobileargs /><br />  
   <input type="submit" value="$lt{'log'}" />  ENDSCRIPT
 </form>  
 LFORM      my ($lonhost_in_use,@hosts,%defaultdomconf,$saml_prefix,$saml_landing,
           $samlssotext,$samlnonsso,$samlssoimg,$samlssoalt,$samlssourl,$samltooltip);
     if ($showbanner) {      %defaultdomconf = &Apache::loncommon::get_domainconf($defdom);
         $r->print(<<HEADER);      @hosts = &Apache::lonnet::current_machine_ids();
 <!-- The LON-CAPA Header -->      $lonhost_in_use = $lonhost;
 <div style="background:$pgbg;margin:0;width:100%;">      if (@hosts > 1) {
   <img src="$img" border="0" alt="The Learning Online Network with CAPA" class="LC_maxwidth" />          foreach my $hostid (@hosts) {
 </div>              if (&Apache::lonnet::host_domain($hostid) eq $defdom) {
 HEADER                  $lonhost_in_use = $hostid;
     }                  last;
     $r->print(<<ENDTOP);              }
 <div style="float:left;margin-top:0;">          }
 <div class="LC_Box" style="background:$loginbox_bg;">      }
   $logintitle      $saml_prefix = $defdom.'.login.saml_';
   $loginform      if ($defaultdomconf{$saml_prefix.$lonhost_in_use}) {
   $noscript_warning          $saml_landing = 1;
 </div>          $samlssotext = $defaultdomconf{$saml_prefix.'text_'.$lonhost_in_use};
             $samlnonsso = $defaultdomconf{$saml_prefix.'notsso_'.$lonhost_in_use};
 <div class="LC_Box" style="padding-top: 10px;">          $samlssoimg = $defaultdomconf{$saml_prefix.'img_'.$lonhost_in_use};
   $loginhelp          $samlssoalt = $defaultdomconf{$saml_prefix.'alt_'.$lonhost_in_use};
   $forgotpw          $samlssourl = $defaultdomconf{$saml_prefix.'url_'.$lonhost_in_use};
   $contactblock          $samltooltip = $defaultdomconf{$saml_prefix.'title_'.$lonhost_in_use};
   $newuserlink      }
   $coursecatalog      if ($saml_landing) {
 </div>         if ($samlssotext eq '') {
 </div>             $samlssotext = 'SSO Login';
          }
 <div>         if ($samlnonsso eq '') {
 ENDTOP             $samlnonsso = 'Non-SSO Login';
     if ($showmainlogo) {         }
         $r->print(' <img src="'.$logo.'" alt="" class="LC_maxwidth" />'."\n");         $js .= <<"ENDSAMLJS";
     }  
 $r->print(<<ENDTOP);  <script type="text/javascript">
 $announcements  // <![CDATA[
 </div>  function toggleLClogin() {
 <hr style="clear:both;" />      if (document.getElementById('LC_standard_login')) {
 ENDTOP          if (document.getElementById('LC_standard_login').style.display == 'none') {
     my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow);              document.getElementById('LC_standard_login').style.display = 'inline-block';
     $domainrow = <<"END";              if (document.getElementById('LC_login_text')) {
       <tr>                  document.getElementById('LC_login_text').innerHTML = '$samlnonsso';
        <td  align="left" valign="top">              }
         <small><b>$lt{'dom'}:&nbsp;</b></small>              if (document.getElementById('LC_SSO_login')) {
        </td>                  document.getElementById('LC_SSO_login').style.display = 'none';
        <td  align="left" valign="top">              }
         <small><tt>&nbsp;$domain</tt></small>          } else {
        </td>              document.getElementById('LC_standard_login').style.display = 'none';
       </tr>              if (document.getElementById('LC_login_text')) {
 END                  document.getElementById('LC_login_text').innerHTML = '$samlssotext';
     $serverrow = <<"END";              }
       <tr>              if (document.getElementById('LC_SSO_login')) {
        <td  align="left" valign="top">                  document.getElementById('LC_SSO_login').style.display = 'inline-block';
         <small><b>$lt{'serv'}:&nbsp;</b></small>              }
        </td>          }
        <td align="left" valign="top">      }
         <small><tt>&nbsp;$lonhost ($role)</tt></small>      return;
        </td>  }
       </tr>  
 END  // ]]>
     if ($loadlim) {  </script>
         $loadrow = <<"END";  
       <tr>  ENDSAMLJS
        <td align="left" valign="top">      }
         <small><b>$lt{'load'}:&nbsp;</b></small>  
        </td>  # --------------------------------------------------- Print login screen header
        <td align="left" valign="top">  
         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>      my %add_entries = (
        </td>         bgcolor      => "$mainbg",
       </tr>         text         => "$font",
 END         link         => "$link",
     }         vlink        => "$vlink",
     if ($uloadlim) {         alink        => "$alink",
         $userloadrow = <<"END";                 onload       => 'javascript:enableInput();',);
       <tr>  
        <td align="left" valign="top">      my ($headextra,$headextra_exempt);
         <small><b>$lt{'userload'}:&nbsp;</b></small>      $headextra = $defaultdomconf{$defdom.'.login.headtag_'.$lonhost_in_use};
        </td>      $headextra_exempt = $defaultdomconf{$domain.'.login.headtag_exempt_'.$lonhost_in_use};
        <td align="left" valign="top">      if ($headextra) {
         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>          my $omitextra;
        </td>          if ($headextra_exempt ne '') {
       </tr>              my @exempt = split(',',$headextra_exempt);
 END              my $ip = &Apache::lonnet::get_requestor_ip();
     }              if (grep(/^\Q$ip\E$/,@exempt)) {
     if (($version ne '') && ($version ne '<!-- VERSION -->')) {                  $omitextra = 1;
         $versionrow = <<"END";              }
       <tr>          }
        <td colspan="2" align="left">          unless ($omitextra) {
         <small>$version</small>              my $confname = $defdom.'-domainconfig';
        </td>              if ($headextra =~ m{^\Q/res/$defdom/$confname/login/headtag/$lonhost_in_use/\E}) {
       </tr>                  my $extra = &Apache::lonnet::getfile(&Apache::lonnet::filelocation("",$headextra));
 END                  unless ($extra eq '-1') {
     }                      $js .= "\n".$extra."\n";
                   }
     $r->print(<<ENDDOCUMENT);              }
     <div style="float: left;">          }
      <table border="0" cellspacing="0" cellpadding="0">      }
 $domainrow  
 $serverrow      $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
 $loadrow             { 'redirect'       => [$expire,'/adm/roles'],
 $userloadrow   'add_entries' => \%add_entries,
 $versionrow   'only_body'   => 1,}));
      </table>  
     </div>  # ----------------------------------------------------------------------- Texts
     <div style="float: right;">  
     $domainlogo      my %lt=&Apache::lonlocal::texthash(
     </div>            'un'       => 'Username',
     <br style="clear:both;" />            'pw'       => 'Password',
  </div>            'dom'      => 'Domain',
             'perc'     => 'percent',
 <script type="text/javascript">            'load'     => 'Server Load',
 // <![CDATA[            'userload' => 'User Load',
 // the if prevents the script error if the browser can not handle this            'catalog'  => 'Course/Community Catalog',
 if ( document.client.uname ) { document.client.uname.focus(); }            'log'      => 'Log in',
 // ]]>            'help'     => 'Log-in Help',
 </script>            'serv'     => 'Server',
 $helpdeskscript            'servadm'  => 'Server Administration',
             'helpdesk' => 'Contact Helpdesk',
 ENDDOCUMENT            'forgotpw' => 'Forgot password?',
     my %endargs = ( 'noredirectlink' => 1, );            'newuser'  => 'New User?',
     $r->print(&Apache::loncommon::end_page(\%endargs));            'change'   => 'Change?',
     return OK;         );
 }  # -------------------------------------------------- Change password field name
   
 sub check_loginvia {      my $forgotpw = &forgotpwdisplay(%lt);
     my ($domain,$lonhost,$lonidsdir,$balcookie) = @_;      $forgotpw .= '<br />' if $forgotpw;
     if ($domain eq '' || $lonhost eq '' || $lonidsdir eq '') {      my $loginhelp = &Apache::lonauth::loginhelpdisplay($authdomain);
         return;      if ($loginhelp) {
     }          $loginhelp = '<a href="'.$loginhelp.'">'.$lt{'help'}.'</a><br />';
     my %domconfhash = &Apache::loncommon::get_domainconf($domain);      }
     my $loginvia = $domconfhash{$domain.'.login.loginvia_'.$lonhost};  
     my $loginvia_exempt = $domconfhash{$domain.'.login.loginvia_exempt_'.$lonhost};  # ---------------------------------------------------- Serve out DES JavaScript
     my $output;      {
     if ($loginvia ne '') {      my $jsh=Apache::File->new($include."/londes.js");
         my $noredirect;      $r->print(<$jsh>);
         my $ip = $ENV{'REMOTE_ADDR'};      }
         if ($ip eq '127.0.0.1') {  # ---------------------------------------------------------- Serve rest of page
             $noredirect = 1;  
         } else {      $r->print(
             if ($loginvia_exempt ne '') {      '<div class="LC_Box"'
                 my @exempt = split(',',$loginvia_exempt);     .' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'
                 if (grep(/^\Q$ip\E$/,@exempt)) {  );
                     $noredirect = 1;  
                 }      $r->print(<<ENDSERVERFORM);
             }  <form name="server" action="/adm/authenticate" method="post" target="_top">
         }     <input type="hidden" name="logtoken" value="$logtoken" />
         unless ($noredirect) {     <input type="hidden" name="serverid" value="$lonhost" />
             my ($newhost,$path);     <input type="hidden" name="uname" value="" />
             if ($loginvia =~ /:/) {     <input type="hidden" name="upass0" value="" />
                 ($newhost,$path) = split(':',$loginvia);     <input type="hidden" name="udom" value="" />
             } else {     <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
                 $newhost = $loginvia;     <input type="hidden" name="localres" value="$env{'form.localres'}" />
             }    </form>
             if ($newhost ne $lonhost) {  ENDSERVERFORM
                 if (&Apache::lonnet::hostname($newhost) ne '') {      my $coursecatalog;
                     if ($balcookie) {      if (($showcoursecat eq '') || ($showcoursecat)) {
                         my ($balancer,$cookie) = split(/:/,$balcookie);          $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';
                         if ($cookie =~ /^($match_domain)_($match_username)_([a-f0-9]+)$/) {      }
                             my ($udom,$uname,$cookieid) = ($1,$2,$3);      my $newuserlink;
                             unless (&Apache::lonnet::delbalcookie($cookie,$balancer) eq 'ok') {      if ($shownewuserlink) {
                                 if ((-d $lonidsdir) && (opendir(my $dh,$lonidsdir))) {          $newuserlink = &newuser_link($lt{'newuser'}).'<br />';
                                     while (my $filename=readdir($dh)) {      }
                                         if ($filename=~/^(\Q$uname\E_\d+_\Q$udom\E_$match_lonid)\.id$/) {      my $logintitle =
                                             my $handle = $1;          '<h2 class="LC_hcell"'
                                             my %hash =         .' style="background:'.$loginbox_header_bgcol.';'
                                                 &Apache::lonnet::get_sessionfile_vars($handle,$lonidsdir,         .' color:'.$loginbox_header_textcol.'">'
                                                                                      ['request.balancercookie',         .$lt{'log'}
                                                                                       'user.linkedenv']);         .'</h2>';
                                             if ($hash{'request.balancercookie'} eq "$balancer:$cookieid") {  
                                                 if (unlink("$lonidsdir/$filename")) {      my $noscript_warning='<noscript><span class="LC_warning"><b>'
                                                     if (($hash{'user.linkedenv'} =~ /^[a-f0-9]+_linked$/) &&                          .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
                                                         (-l "$lonidsdir/$hash{'user.linkedenv'}.id") &&                          .'</b></span></noscript>';
                                                         (readlink("$lonidsdir/$hash{'user.linkedenv'}.id") eq "$lonidsdir/$filename")) {      my $helpdeskscript;
                                                         unlink("$lonidsdir/$hash{'user.linkedenv'}.id");      my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
                                                     }                                         $authdomain,\$helpdeskscript,
                                                 }                                         $showhelpdesk,\@possdoms);
                                             }  
                                             last;      my $mobileargs;
                                         }      if ($clientmobile) {
                                     }          $mobileargs = 'autocapitalize="off" autocorrect="off"';
                                     closedir($dh);      }
                                 }      my $loginform=(<<LFORM);
                             }  <form name="client" action="" onsubmit="return(send())" id="lclogin">
                         }    <input type="hidden" name="lextkey" value="$lextkey" />
                     }    <input type="hidden" name="uextkey" value="$uextkey" />
                     $output = &redirect_page($newhost,$path);    <b><label for="uname">$lt{'un'}</label>:</b><br />
                 }    <input type="text" name="uname" id="uname" size="15" value="$authusername" readonly="readonly" $mobileargs /><br />
             }    <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
         }    <input type="password" name="upass$now" id="upass$now" size="15" readonly="readonly" /><br />
     }    <b><label for="udom">$lt{'dom'}</label>:</b><br />
     return $output;    <input type="text" name="udom" id="udom" size="15" value="$authdomain" readonly="readonly" $mobileargs /><br />
 }    <input type="submit" value="$lt{'log'}" />
   </form>
 sub redirect_page {  LFORM
     my ($desthost,$path) = @_;  
     my $hostname = &Apache::lonnet::hostname($desthost);      if ($showbanner) {
     my $protocol = $Apache::lonnet::protocol{$desthost};          $r->print(<<HEADER);
     $protocol = 'http' if ($protocol ne 'https');  <!-- The LON-CAPA Header -->
     unless ($path =~ m{^/}) {  <div style="background:$pgbg;margin:0;width:100%;">
         $path = '/'.$path;    <img src="$img" border="0" alt="The Learning Online Network with CAPA" class="LC_maxwidth" />
     }  </div>
     my $url = $protocol.'://'.$hostname.$path;  HEADER
     if ($env{'form.firsturl'} ne '') {      }
         $url .='?firsturl='.$env{'form.firsturl'};  
     }      my $stdauthformstyle = 'inline-block';
     my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,      my $ssoauthstyle = 'none';
                                                     {'redirect' => [0,$url],});      my $logintype;
     my $end_page   = &Apache::loncommon::end_page();      $r->print('<div style="float:left;margin-top:0;">');
     return $start_page.$end_page;      if ($saml_landing) {
 }          $ssoauthstyle = 'inline-block';
           $stdauthformstyle = 'none';
 sub contactdisplay {          $logintype = $samlssotext;
     my ($lt,$servadm,$showadminmail,$authdomain,$helpdeskscript,$showhelpdesk,          my $ssologin = '/adm/sso';
         $possdoms) = @_;          if ($samlssourl  ne '') {
     my $contactblock;              $ssologin = $samlssourl;
     my $origmail;          }
     if (ref($possdoms) eq 'ARRAY') {          if ($env{'form.firsturl'} ne '') {
         if (grep(/^\Q$authdomain\E$/,@{$possdoms})) {               my $querystring;
             $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};              if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
         }                  $querystring = &uri_escape_utf8($env{'form.firsturl'});
     }              } else {
     my $requestmail =                   $querystring = &uri_escape($env{'form.firsturl'});
         &Apache::loncommon::build_recipient_list(undef,'helpdeskmail',              }
                                                  $authdomain,$origmail);              $querystring = &HTML::Entities::encode($querystring,"'");
     unless ($showhelpdesk eq '0') {              $ssologin .= (($ssologin=~/\?/)?'&amp;':'?') . $querystring;
         if ($requestmail =~ m/[^\@]+\@[^\@]+/) {          }
             $showhelpdesk = 1;          my $ssohref;
         } else {          if ($samlssoimg ne '') {
             $showhelpdesk = 0;              $ssohref = '<a href="'.$ssologin.'" title="'.$samltooltip.'"><img src="'.$samlssoimg.'" alt="'.$samlssoalt.'" /></a>';
         }          } else {
     }              $ssohref = '<a href="'.$ssologin.'">'.$samlssotext.'</a>';
     if ($servadm && $showadminmail) {          }
         $contactblock .= $$lt{'servadm'}.':<br />'.          if (($env{'form.saml'} eq 'no') ||
                          '<tt>'.$servadm.'</tt><br />';              (($env{'form.username'} ne '') && ($env{'form.domain'} ne ''))) {
     }              $ssoauthstyle = 'none';
     if ($showhelpdesk) {              $stdauthformstyle = 'inline-block';
         $contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';              $logintype = $samlnonsso;
         my $thisurl = &escape('/adm/login');          }
         $$helpdeskscript = <<"ENDSCRIPT";          $r->print(<<ENDSAML);
 <script type="text/javascript">  <p>
 // <![CDATA[  Log-in type:
 function helpdesk() {  <span style="font-weight:bold" id="LC_login_text">$logintype</span><br />
     var possdom = document.client.udom.value;  <span><a href="javascript:toggleLClogin();" style="color:#000000">$lt{'change'}</a></span>
     var codedom = possdom.replace( new RegExp("[^A-Za-z0-9.\\-]","g"),'');  </p>
     if (codedom == '') {  <div style="display:$ssoauthstyle" id="LC_SSO_login">
         codedom = "$authdomain";  <div class="LC_Box" style="padding-top: 10px;">
     }  $ssohref
     var querystr = "origurl=$thisurl&codedom="+codedom;  $noscript_warning
     document.location.href = "/adm/helpdesk?"+querystr;  </div>
     return;  <div class="LC_Box" style="padding-top: 10px;">
 }  $loginhelp
 // ]]>  $contactblock
 </script>  $coursecatalog
 ENDSCRIPT  </div>
     }  </div>
     return $contactblock;  ENDSAML
 }      }
   
 sub forgotpwdisplay {      $r->print(<<ENDLOGIN);
     my (%lt) = @_;  <div style="display:$stdauthformstyle;" id="LC_standard_login">
     my $prompt_for_resetpw = 1;   <div class="LC_Box" style="background:$loginbox_bg;">
     if ($prompt_for_resetpw) {    $logintitle
         return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';    $loginform
     }    $noscript_warning
     return;  </div>
 }   
   <div class="LC_Box" style="padding-top: 10px;">
 sub coursecatalog_link {    $loginhelp
     my ($linkname) = @_;    $forgotpw
     return <<"END";    $contactblock
       <a href="/adm/coursecatalog">$linkname</a>    $newuserlink
 END    $coursecatalog
 }  </div>
   </div>
 sub newuser_link {  
     my ($linkname) = @_;  ENDLOGIN
     return '<a href="/adm/createaccount">'.$linkname.'</a>';      $r->print('</div><div>'."\n");
 }      if ($showmainlogo) {
           $r->print(' <img src="'.$logo.'" alt="" class="LC_maxwidth" />'."\n");
 1;      }
 __END__  $r->print(<<ENDTOP);
   $announcements
   </div>
   <hr style="clear:both;" />
   ENDTOP
       my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow);
       $domainrow = <<"END";
         <tr>
          <td  align="left" valign="top">
           <small><b>$lt{'dom'}:&nbsp;</b></small>
          </td>
          <td  align="left" valign="top">
           <small><tt>&nbsp;$domain</tt></small>
          </td>
         </tr>
   END
       $serverrow = <<"END";
         <tr>
          <td  align="left" valign="top">
           <small><b>$lt{'serv'}:&nbsp;</b></small>
          </td>
          <td align="left" valign="top">
           <small><tt>&nbsp;$lonhost ($role)</tt></small>
          </td>
         </tr>
   END
       if ($loadlim) {
           $loadrow = <<"END";
         <tr>
          <td align="left" valign="top">
           <small><b>$lt{'load'}:&nbsp;</b></small>
          </td>
          <td align="left" valign="top">
           <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
          </td>
         </tr>
   END
       }
       if ($uloadlim) {
           $userloadrow = <<"END";
         <tr>
          <td align="left" valign="top">
           <small><b>$lt{'userload'}:&nbsp;</b></small>
          </td>
          <td align="left" valign="top">
           <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
          </td>
         </tr>
   END
       }
       if (($version ne '') && ($version ne '<!-- VERSION -->')) {
           $versionrow = <<"END";
         <tr>
          <td colspan="2" align="left">
           <small>$version</small>
          </td>
         </tr>
   END
       }
   
       $r->print(<<ENDDOCUMENT);
       <div style="float: left;">
        <table border="0" cellspacing="0" cellpadding="0">
   $domainrow
   $serverrow
   $loadrow    
   $userloadrow
   $versionrow
        </table>
       </div>
       <div style="float: right;">
       $domainlogo
       </div>
       <br style="clear:both;" />
    </div>
   
   <script type="text/javascript">
   // <![CDATA[
   // the if prevents the script error if the browser can not handle this
   if ( document.client.uname ) { document.client.uname.focus(); }
   // ]]>
   </script>
   $helpdeskscript
   
   ENDDOCUMENT
       my %endargs = ( 'noredirectlink' => 1, );
       $r->print(&Apache::loncommon::end_page(\%endargs));
       return OK;
   }
   
   sub check_loginvia {
       my ($domain,$lonhost,$lonidsdir,$balcookie,$linkprot) = @_;
       if ($domain eq '' || $lonhost eq '' || $lonidsdir eq '') {
           return;
       }
       my %domconfhash = &Apache::loncommon::get_domainconf($domain);
       my $loginvia = $domconfhash{$domain.'.login.loginvia_'.$lonhost};
       my $loginvia_exempt = $domconfhash{$domain.'.login.loginvia_exempt_'.$lonhost};
       my $output;
       if ($loginvia ne '') {
           my $noredirect;
           my $ip = &Apache::lonnet::get_requestor_ip();  
           if ($ip eq '127.0.0.1') {
               $noredirect = 1;
           } else {
               if ($loginvia_exempt ne '') {
                   my @exempt = split(',',$loginvia_exempt);
                   if (grep(/^\Q$ip\E$/,@exempt)) {
                       $noredirect = 1;
                   }
               }
           }
           unless ($noredirect) {
               my ($newhost,$path);
               if ($loginvia =~ /:/) {
                   ($newhost,$path) = split(':',$loginvia);
               } else {
                   $newhost = $loginvia;
               }
               if ($newhost ne $lonhost) {
                   if (&Apache::lonnet::hostname($newhost) ne '') {
                       if ($balcookie) {
                           my ($balancer,$cookie) = split(/:/,$balcookie);
                           if ($cookie =~ /^($match_domain)_($match_username)_([a-f0-9]+)$/) {
                               my ($udom,$uname,$cookieid) = ($1,$2,$3);
                               unless (&Apache::lonnet::delbalcookie($cookie,$balancer) eq 'ok') {
                                   if ((-d $lonidsdir) && (opendir(my $dh,$lonidsdir))) {
                                       while (my $filename=readdir($dh)) {
                                           if ($filename=~/^(\Q$uname\E_\d+_\Q$udom\E_$match_lonid)\.id$/) {
                                               my $handle = $1;
                                               my %hash =
                                                   &Apache::lonnet::get_sessionfile_vars($handle,$lonidsdir,
                                                                                        ['request.balancercookie',
                                                                                         'user.linkedenv']);
                                               if ($hash{'request.balancercookie'} eq "$balancer:$cookieid") {
                                                   if (unlink("$lonidsdir/$filename")) {
                                                       if (($hash{'user.linkedenv'} =~ /^[a-f0-9]+_linked$/) &&
                                                           (-l "$lonidsdir/$hash{'user.linkedenv'}.id") &&
                                                           (readlink("$lonidsdir/$hash{'user.linkedenv'}.id") eq "$lonidsdir/$filename")) {
                                                           unlink("$lonidsdir/$hash{'user.linkedenv'}.id");
                                                       }
                                                   }
                                               }
                                               last;
                                           }
                                       }
                                       closedir($dh);
                                   }
                               }
                           }
                       }
                       $output = &redirect_page($newhost,$path,$linkprot);
                   }
               }
           }
       }
       return $output;
   }
   
   sub redirect_page {
       my ($desthost,$path,$linkprot) = @_;
       my $hostname = &Apache::lonnet::hostname($desthost);
       my $protocol = $Apache::lonnet::protocol{$desthost};
       $protocol = 'http' if ($protocol ne 'https');
       unless ($path =~ m{^/}) {
           $path = '/'.$path;
       }
       my $url = $protocol.'://'.$hostname.$path;
       if ($env{'form.firsturl'} ne '') {
           my $querystring;
           if ($env{'form.firsturl'} =~ /[^\x00-\xFF]/) {
               $querystring = &uri_escape_utf8($env{'form.firsturl'});
           } else {
               $querystring = &uri_escape($env{'form.firsturl'});
           }
           $querystring = &HTML::Entities::encode($querystring,"'");
           $url .='?firsturl='.$querystring
       }
       if ($linkprot) {
           my $ltoken = &Apache::lonnet::tmpput({linkprot => $linkprot},$desthost);
           if ($ltoken) {
               $url .= (($url =~ /\?/) ? '&amp;' : '?').'ltoken='.$ltoken;
           }
       }
       my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
                                                       {'redirect' => [0,$url],});
       my $end_page   = &Apache::loncommon::end_page();
       return $start_page.$end_page;
   }
   
   sub contactdisplay {
       my ($lt,$servadm,$showadminmail,$authdomain,$helpdeskscript,$showhelpdesk,
           $possdoms) = @_;
       my $contactblock;
       my $origmail;
       if (ref($possdoms) eq 'ARRAY') {
           if (grep(/^\Q$authdomain\E$/,@{$possdoms})) {
               $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
           }
       }
       my $requestmail =
           &Apache::loncommon::build_recipient_list(undef,'helpdeskmail',
                                                    $authdomain,$origmail);
       unless ($showhelpdesk eq '0') {
           if ($requestmail =~ m/[^\@]+\@[^\@]+/) {
               $showhelpdesk = 1;
           } else {
               $showhelpdesk = 0;
           }
       }
       if ($servadm && $showadminmail) {
           $contactblock .= $$lt{'servadm'}.':<br />'.
                            '<tt>'.$servadm.'</tt><br />';
       }
       if ($showhelpdesk) {
           $contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';
           my $thisurl = &escape('/adm/login');
           $$helpdeskscript = <<"ENDSCRIPT";
   <script type="text/javascript">
   // <![CDATA[
   function helpdesk() {
       var possdom = document.client.udom.value;
       var codedom = possdom.replace( new RegExp("[^A-Za-z0-9.\\-]","g"),'');
       if (codedom == '') {
           codedom = "$authdomain";
       }
       var querystr = "origurl=$thisurl&codedom="+codedom;
       document.location.href = "/adm/helpdesk?"+querystr;
       return;
   }
   // ]]>
   </script>
   ENDSCRIPT
       }
       return $contactblock;
   }
   
   sub forgotpwdisplay {
       my (%lt) = @_;
       my $prompt_for_resetpw = 1;
       if ($prompt_for_resetpw) {
           return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';
       }
       return;
   }
   
   sub coursecatalog_link {
       my ($linkname) = @_;
       return <<"END";
         <a href="/adm/coursecatalog">$linkname</a>
   END
   }
   
   sub newuser_link {
       my ($linkname) = @_;
       return '<a href="/adm/createaccount">'.$linkname.'</a>';
   }
   
   1;
   __END__

Removed from v.1.158.2.8  
changed lines
  Added in v.1.188


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