Diff for /loncom/auth/lonlogin.pm between versions 1.38 and 1.176

version 1.38, 2003/03/10 14:29:37 version 1.176, 2018/12/05 03:29:05
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/
 #  #
 # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,  
 # 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9,  package Apache::lonlogin;
 # 1/17/01 Gerd Kortemeyer  
 #  use strict;
 # 2/7/02,2/8,2/12,2/14,2/15,2/19 Josh Brunskole  use Apache::Constants qw(:common);
 #   use Apache::File ();
 # 7/10/02 Jeremy Bowers  use Apache::lonnet;
   use Apache::loncommon();
 package Apache::lonlogin;  use Apache::lonauth();
   use Apache::lonlocal;
 use strict;  use Apache::migrateuser();
 use Apache::Constants qw(:common);  use lib '/home/httpd/lib/perl/';
 use Apache::File ();  use LONCAPA qw(:DEFAULT :match);
 use Apache::lonnet();  use CGI::Cookie();
 use Apache::loncommon();   
   sub handler {
 sub handler {      my $r = shift;
     my $r = shift;  
     $r->content_type('text/html');      &Apache::loncommon::get_unprocessed_cgi
     &Apache::loncommon::no_cache($r);   (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
     $r->send_http_header;        $ENV{'REDIRECT_QUERY_STRING'}),
     return OK if $r->header_only;   ['interface','username','domain','firsturl','localpath','localres',
     'token','role','symb','iptoken','btoken']);
       if (!defined($env{'form.firsturl'})) {
     &Apache::loncommon::get_unprocessed_cgi          &Apache::lonacc::get_posted_cgi($r,['firsturl']);
      ($ENV{'QUERY_STRING'},['interface','username','domain','firsturl']);      }
       if (!defined($env{'form.firsturl'})) {
 # ----------------------------------------------------------- Process Interface          if ($ENV{'REDIRECT_URL'} =~ m{^/+tiny/+$LONCAPA::match_domain/+\w+$}) {
     $ENV{'form.interface'}=~s/\W//g;              $env{'form.firsturl'} = $ENV{'REDIRECT_URL'};
           }
     my $textbrowsers=$r->dir_config('lonTextBrowsers');      }
     my $httpbrowser=$ENV{"HTTP_USER_AGENT"};  
       # -- check if they are a migrating user
     foreach (split(/\:/,$textbrowsers)) {      if (defined($env{'form.token'})) {
  if ($httpbrowser=~/$_/i) {   return &Apache::migrateuser::handler($r);
     $ENV{'form.interface'}='textual';      }
         }  
     }  # For "public user" - remove any exising "public" cookie, as user really wants to log-in
       my ($handle,$lonidsdir,$expirepub,$userdom);
     my $fullgraph=($ENV{'form.interface'} ne 'textual');      $lonidsdir=$r->dir_config('lonIDsDir');
       unless ($r->header_only) {
     my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':8080'.          $handle = &Apache::lonnet::check_for_valid_session($r,'lonID',undef,\$userdom);
                   $r->dir_config('lonIconsURL');          if ($handle ne '') {
     my $domain  = $r->dir_config('lonDefDomain');              if ($handle=~/^publicuser\_/) {
     my $role    = $r->dir_config('lonRole');                  unlink($r->dir_config('lonIDsDir')."/$handle.id");
     my $loadlim = $r->dir_config('lonLoadLim');                  undef($handle);
     my $servadm = $r->dir_config('lonAdmEMail');                  undef($userdom);
     my $sysadm  = $r->dir_config('lonSysEMail');                  $expirepub = 1;
     my $lonhost = $r->dir_config('lonHostID');              }
     my $tabdir  = $r->dir_config('lonTabDir');          }
     my $include = $r->dir_config('lonIncludes');      }
     my $expire  = $r->dir_config('lonExpire');  
       &Apache::loncommon::no_cache($r);
 # --------------------------------------------- Default values for login fields      &Apache::lonlocal::get_language_handle($r);
       &Apache::loncommon::content_type($r,'text/html');
     my $authusername=($ENV{'form.username'}?$ENV{'form.username'}:'');      if ($expirepub) {
     my $authdomain=($ENV{'form.domain'}?$ENV{'form.domain'}:$domain);          my $c = new CGI::Cookie(-name    => 'lonPubID',
                                   -value   => '',
 # ---------------------------------------------------------- Determine own load                                  -expires => '-10y',);
     my $loadavg;          $r->header_out('Set-cookie' => $c);
    {      } elsif (($handle eq '') && ($userdom ne '')) {
        my $loadfile=Apache::File->new('/proc/loadavg');          my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
        $loadavg=<$loadfile>;          foreach my $name (keys(%cookies)) {
    }              next unless ($name =~ /^lon(|S|Link|Pub)ID$/);
     $loadavg =~ s/\s.*//g;              my $c = new CGI::Cookie(-name    => $name,
     my $loadpercent=100*$loadavg/$loadlim;                                      -value   => '',
                                       -expires => '-10y',);
 # ------------------------------------------------------- Do the load balancing              $r->headers_out->add('Set-cookie' => $c);
     my $otherserver='http://'.$ENV{'SERVER_NAME'};          }
     my $firsturl=      }
     ($ENV{'request.firsturl'}?$ENV{'request.firsturl'}:$ENV{'form.firsturl'});      $r->send_http_header;
 # ---------------------------------------- Are we access server and overloaded?      return OK if $r->header_only;
     if (($role eq 'access') && ($loadpercent>100.0)) {  
         $otherserver=Apache::lonnet::spareserver($loadpercent);  
     }  # Are we re-routing?
       my $londocroot = $r->dir_config('lonDocRoot');
 # -------------------------------------------------------- Set login parameters      if (-e "$londocroot/lon-status/reroute.txt") {
    &Apache::lonauth::reroute($r);
     my @hexstr=('0','1','2','3','4','5','6','7',   return OK;
                 '8','9','a','b','c','d','e','f');      }
     my $lkey='';  
     for (0..7) {      my $lonhost = $r->dir_config('lonHostID');
         $lkey.=$hexstr[rand(15)];      $env{'form.firsturl'} =~ s/(`)/'/g;
     }  
   # Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer)
     my $ukey='';  
     for (0..7) {      my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r,1);
         $ukey.=$hexstr[rand(15)];      if ($found_server) {
     }          my $hostname = &Apache::lonnet::hostname($found_server);
           if ($hostname ne '') {
     my $lextkey=hex($lkey);              my $protocol = $Apache::lonnet::protocol{$found_server};
     if ($lextkey>2147483647) { $lextkey-=4294967296; }              $protocol = 'http' if ($protocol ne 'https');
               my $dest = '/adm/roles';
     my $uextkey=hex($ukey);              if ($env{'form.firsturl'} ne '') {
     if ($uextkey>2147483647) { $uextkey-=4294967296; }                  $dest = $env{'form.firsturl'};
               }
 # -------------------------------------------------------- Store away log token              my %info = (
     my $logtoken=Apache::lonnet::reply(                           balcookie => $lonhost.':'.$balancer_cookie,
        'tmpput:'.$ukey.$lkey.'&'.$firsturl,                         );
        $lonhost);              my $balancer_token = &Apache::lonnet::tmpput(\%info,$found_server);
               if ($balancer_token) {
 # ------------------- If we cannot talk to ourselves, we are in serious trouble                  $dest .=  (($dest=~/\?/)?'&;':'?') . 'btoken='.$balancer_token;
               }
     if ($logtoken eq 'con_lost') {              my $url = $protocol.'://'.$hostname.$dest;
         my $spares='';              my $start_page =
         foreach (keys %Apache::lonnet::hostname) {                  &Apache::loncommon::start_page('Switching Server ...',undef,
             if ($_ ne $lonhost) {                                                 {'redirect'       => [0,$url],});
                $spares.='<br /><a href="http://'.$Apache::lonnet::hostname{$_}.              my $end_page   = &Apache::loncommon::end_page();
  '/adm/login?domain='.$authdomain.'">'.              $r->print($start_page.$end_page);
                  $Apache::lonnet::hostname{$_}.'</a>';              return OK;
                if ($Apache::lonnet::spareid{$_}) {          }
    $spares.=' (preferred)';      }
                }  
    }  #
         }  # Check if a LON-CAPA load balancer sent user here because user's browser sent
  $r->print(<<ENDTROUBLE);  # it a balancer cookie for an active session on this server.
 <html>  #
 <head><title>The LearningOnline Network with CAPA</title></head>  
 <body bgcolor="#FFFFFF">      my $balcookie;
 <img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />      if ($env{'form.btoken'}) {
 <h3>This LON-CAPA server is temporarily not available for login</h3>          my %info = &Apache::lonnet::tmpget($env{'form.btoken'});
 <p>Please attempt to login to one of the following servers:</p>$spares          $balcookie = $info{'balcookie'};
 <p>If the problem persists, please contact <tt>$servadm</tt>.</p>          &Apache::lonnet::tmpdel($env{'form.btoken'});
 </body>          delete($env{'form.btoken'});
 </html>      }
 ENDTROUBLE  
         return OK;  #
     }  # If browser sent an old cookie for which the session file had been removed
   # check if configuration for user's domain has a portal URL set.  If so
 # ----------------------------------------------- Apparently we are in business  # switch user's log-in to the portal.
   #
     my $domainlogo=&Apache::loncommon::domainlogo();  
     $servadm=~s/\,/\<br \/\>/g;      if (($handle eq '') && ($userdom ne '')) {
     $sysadm=~s/\,/\<br \/\>/g;          my %domdefaults = &Apache::lonnet::get_domain_defaults($userdom);
           if ($domdefaults{'portal_def'} =~ /^https?\:/) {
 # --------------------------------------------------- Print login screen header              my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
     $r->print(<<ENDHEADER);                                            {'redirect' => [0,$domdefaults{'portal_def'}],});
 <html>              my $end_page   = &Apache::loncommon::end_page();
 <head>              $r->print($start_page.$end_page);
 <meta HTTP-EQUIV="Refresh" CONTENT="$expire; url=/adm/roles" />              return OK;
 <title>The LearningOnline Network with CAPA Login</title>          }
 </head>      }
 ENDHEADER  
 # ---------------------------------------------------- Serve out DES JavaScript  # -------------------------------- Prevent users from attempting to login twice
     {      if ($handle ne '') {
  my $jsh=Apache::File->new($include."/londes.js");          &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
         $r->print(<$jsh>);   my $start_page =
     }      &Apache::loncommon::start_page('Already logged in');
    my $end_page =
 # ----------------------------------------------------------- Front page design      &Apache::loncommon::end_page();
     my $pgbg=          my $dest = '/adm/roles';
       ($fullgraph?&Apache::loncommon::designparm('login.pgbg'):'#FFFFFF');          if ($env{'form.firsturl'} ne '') {
     my $font=              $dest = $env{'form.firsturl'};
       ($fullgraph?&Apache::loncommon::designparm('login.font'):'#000000');          }
     my $link=   $r->print(
       ($fullgraph?&Apache::loncommon::designparm('login.link'):'#0000FF');                    $start_page
     my $vlink=                   .'<p class="LC_warning">'.&mt('You are already logged in!').'</p>'
       ($fullgraph?&Apache::loncommon::designparm('login.vlink'):'#0000FF');                   .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
     my $alink=&Apache::loncommon::designparm('login.alink');                    '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
     my $mainbg=                   .$end_page
       ($fullgraph?&Apache::loncommon::designparm('login.mainbg'):'#FFFFFF');                   );
     my $sidebg=          return OK;
       ($fullgraph?&Apache::loncommon::designparm('login.sidebg'):'#FFFFFF');      }
     my $logo=&Apache::loncommon::designparm('login.logo');  
     my $img=&Apache::loncommon::designparm('login.img');  # ---------------------------------------------------- No valid token, continue
   
   # ---------------------------- Not possible to really login to domain "public"
 # ---------------------------------------------------------- Serve rest of page      if ($env{'form.domain'} eq 'public') {
     $r->print(<<ENDSCRIPT);   $env{'form.domain'}='';
    $env{'form.username'}='';
 <body bgcolor="$pgbg" text="$font" link="$link" vlink="$vlink" alink="$alink"      }
   topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>  
   # ------ Is this page requested because /adm/migrateuser detected an IP change?
  <script language="JavaScript">      my %sessiondata;
     function send()      if ($env{'form.iptoken'}) {
     {          %sessiondata = &Apache::lonnet::tmpget($env{'form.iptoken'});
  this.document.server.elements.uname.value          unless ($sessiondata{'sessionserver'}) {
        =this.document.client.elements.uname.value;              my $delete = &Apache::lonnet::tmpdel($env{'form.iptoken'});
               delete($env{'form.iptoken'});
         this.document.server.elements.udom.value          }
        =this.document.client.elements.udom.value;      }
   # ----------------------------------------------------------- Process Interface
         this.document.server.elements.imagesuppress.value      $env{'form.interface'}=~s/\W//g;
        =this.document.client.elements.imagesuppress.checked;  
       (undef,undef,undef,undef,undef,undef,my $clientmobile) =
         this.document.server.elements.embedsuppress.value          &Apache::loncommon::decode_user_agent();
        =this.document.client.elements.embedsuppress.checked;  
       my $iconpath=
         this.document.server.elements.appletsuppress.value   &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
        =this.document.client.elements.appletsuppress.checked;  
       my $domain = &Apache::lonnet::default_login_domain();
         this.document.server.elements.fontenhance.value      my $defdom = $domain;
        =this.document.client.elements.fontenhance.checked;      if ($lonhost ne '') {
           unless ($sessiondata{'sessionserver'}) {
         this.document.server.elements.blackwhite.value              my $redirect = &check_loginvia($domain,$lonhost,$lonidsdir,$balcookie);
        =this.document.client.elements.blackwhite.checked;              if ($redirect) {
                   $r->print($redirect);
         this.document.server.elements.remember.value                  return OK;
        =this.document.client.elements.remember.checked;              }
           }
         uextkey=this.document.client.elements.uextkey.value;      }
         lextkey=this.document.client.elements.lextkey.value;  
         initkeys();      if (($sessiondata{'domain'}) &&
           (&Apache::lonnet::domain($sessiondata{'domain'},'description'))) {
         this.document.server.elements.upass.value          $domain=$sessiondata{'domain'};
     =crypted(this.document.client.elements.upass.value);      } elsif (($env{'form.domain'}) &&
    (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
         this.document.server.submit();   $domain=$env{'form.domain'};
  return false;      }
     }  
  </script>      my $role    = $r->dir_config('lonRole');
 ENDSCRIPT      my $loadlim = $r->dir_config('lonLoadLim');
       my $uloadlim= $r->dir_config('lonUserLoadLim');
     if ($fullgraph) {      my $servadm = $r->dir_config('lonAdmEMail');
  $r->print(      my $tabdir  = $r->dir_config('lonTabDir');
   '<table width="100%" cellpadding=0 cellspacing=0 border=0>');      my $include = $r->dir_config('lonIncludes');
     }      my $expire  = $r->dir_config('lonExpire');
       my $version = $r->dir_config('lonVersion');
     $r->print(<<ENDSERVERFORM);      my $host_name = &Apache::lonnet::hostname($lonhost);
   <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">  
    <input type="hidden" name="logtoken" value="$logtoken" />  # --------------------------------------------- Default values for login fields
    <input type="hidden" name="serverid" value="$lonhost" />     
    <input type="hidden" name="interface" value="$ENV{'form.interface'}" />      my ($authusername,$authdomain);
    <input type="hidden" name="uname" value="" />      if ($sessiondata{'username'}) {
    <input type="hidden" name="upass" value="" />          $authusername=$sessiondata{'username'};
    <input type="hidden" name="udom" value="" />      } else {
    <input type="hidden" name="imagesuppress"  value="" />          $env{'form.username'} = &Apache::loncommon::cleanup_html($env{'form.username'});
    <input type="hidden" name="appletsuppress"  value="" />          $authusername=($env{'form.username'}?$env{'form.username'}:'');
    <input type="hidden" name="embedsuppress"  value="" />      }
    <input type="hidden" name="fontenhance"  value="" />      if ($sessiondata{'domain'}) {
    <input type="hidden" name="blackwhite"  value="" />          $authdomain=$sessiondata{'domain'};
    <input type="hidden" name="remember"  value="" />      } else {
   </form>          $env{'form.domain'} = &Apache::loncommon::cleanup_html($env{'form.domain'});
 ENDSERVERFORM          $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
     if ($fullgraph) { $r->print(<<ENDTOP);      }
   <!-- The LON-CAPA Header -->  
   <tr>  # ---------------------------------------------------------- Determine own load
       my $loadavg;
    <!-- Row 1 Columns 2-4 -->      {
    <td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="$pgbg"><img src="$img" border=0 alt="The Learning Online Network with CAPA" /></td>   my $loadfile=Apache::File->new('/proc/loadavg');
   </tr>   $loadavg=<$loadfile>;
       }
   <!-- The gray bar that starts the two table frames -->      $loadavg =~ s/\s.*//g;
   <tr>  
       my ($loadpercent,$userloadpercent);
    <!-- Row 2 Column 1 -->      if ($loadlim) {
    <td width=182 height=27 bgcolor="$sidebg">&nbsp;</td>          $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
       }
    <!-- Row 2 Column 2 -->      if ($uloadlim) {
    <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>          $userloadpercent=&Apache::lonnet::userload();
       }
    <!-- Row 2 Column 3 -->  
    <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" alt="" /></td>      my $firsturl=
       ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
    <!-- Row 2 Column 4 -->  
    <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 alt="" /></td>  # ----------------------------------------------------------- Get announcements
   </tr>      my $announcements=&Apache::lonnet::getannounce();
   <tr>  # -------------------------------------------------------- Set login parameters
      
    <!-- A cell that will hold the 'access' and 'about' buttons -->      my @hexstr=('0','1','2','3','4','5','6','7',
    <!-- Row 3 Column 1 -->                  '8','9','a','b','c','d','e','f');
    <td valign="top" height=60 align="center" bgcolor="$sidebg">      my $lkey='';
     <a href="/adm/login?interface=textual"><img src="$iconpath/accessbutton.gif" border=0 alt="Accessibility Options" /></a>      for (0..7) {
     <br />          $lkey.=$hexstr[rand(15)];
     <a href="/adm/about.html"><img src="$iconpath/aboutlon.gif" border=0 alt="About LON-CAPA" /></a>      }
    </td>  
       my $ukey='';
    <!-- The shaded space between the two main columns -->      for (0..7) {
    <!-- Row 3 Column 2 -->          $ukey.=$hexstr[rand(15)];
    <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>      }
   
    <!-- The right main column holding the large LON-CAPA logo-->      my $lextkey=hex($lkey);
    <!-- Rows 3-4 Column 3 -->      if ($lextkey>2147483647) { $lextkey-=4294967296; }
    <td align="center" valign="top" width="100%" height="100%" rowspan=2 bgcolor="$mainbg">  
     <center>      my $uextkey=hex($ukey);
      <img src="$logo" alt="" />      if ($uextkey>2147483647) { $uextkey-=4294967296; }
     </center>  
    </td>  # -------------------------------------------------------- Store away log token
       my $tokenextras;
    <!-- Row 3 Column 4 -->      if ($env{'form.role'}) {
    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>          $tokenextras = '&role='.&escape($env{'form.role'});
   </tr>      }
   <tr>      if ($env{'form.symb'}) {
           if (!$tokenextras) {
    <!-- The entry form -->              $tokenextras = '&';
    <!-- Row 4 Column 1 -->          }
    <td align="center" valign="middle" bgcolor="$sidebg">          $tokenextras .= '&symb='.&escape($env{'form.symb'});
 ENDTOP      }
 } else {      if ($env{'form.iptoken'}) {
     $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1><h2>Text-based Interface Login</h2>');          if (!$tokenextras) {
 }              $tokenextras = '&&';
     $r->print('<form name="client" onsubmit="return(send())">');          }
     unless ($fullgraph) {          $tokenextras .= '&iptoken='.&escape($env{'form.iptoken'});
         $r->print(<<ENDACCESSOPTIONS);      }
 <h3>Select Accessibility Options</h3>      my $logtoken=Apache::lonnet::reply(
 <input type="checkbox" name="imagesuppress" /> Suppress rendering of images<br />         'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
 <input type="checkbox" name="appletsuppress" /> Suppress Java applets<br />         $lonhost);
 <input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia<br />  
 <input type="checkbox" name="fontenhance" /> Increase font size<br />  # -- If we cannot talk to ourselves, or hostID does not map to a hostname
 <input type="checkbox" name="blackwhite" /> Switch to black and white mode<br />  #    we are in serious trouble
 <p>If you have accessibility needs that are not addressed by this interface,   
 please      if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {
 contact the system administrator at <tt>$sysadm</tt>.</p><br />          if ($logtoken eq 'no_such_host') {
 <input type="checkbox" name="remember" /> Remember these settings for next login<hr />              &Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab');
 ENDACCESSOPTIONS          }
 } else {          my $spares='';
     $r->print(<<ENDNOOPT);   my $last;
 <input type="hidden" name="imagesuppress"  value="" />          foreach my $hostid (sort
 <input type="hidden" name="embedsuppress"  value="" />      {
 <input type="hidden" name="appletsuppress"  value="" />   &Apache::lonnet::hostname($a) cmp
 <input type="hidden" name="fontenhance"  value="" />      &Apache::lonnet::hostname($b);
 <input type="hidden" name="blackwhite"  value="" />      }
 <input type="hidden" name="remember"  value="" />      keys(%Apache::lonnet::spareid)) {
 ENDNOOPT              next if ($hostid eq $lonhost);
 }      my $hostname = &Apache::lonnet::hostname($hostid);
     $r->print(<<ENDLOGIN);      next if (($last eq $hostname) || ($hostname eq ''));
      <input type="hidden" name="lextkey" value="$lextkey">              $spares.='<br /><font size="+1"><a href="http://'.
      <input type="hidden" name="uextkey" value="$uextkey">                  $hostname.
                   '/adm/login?domain='.$authdomain.'">'.
      <!-- Start the sub-table for text and input alignment -->                  $hostname.'</a>'.
      <table border=0 cellspacing=0 cellpadding=0>                  ' '.&mt('(preferred)').'</font>'.$/;
       <tr><td bgcolor="$sidebg" colspan=2><img src="$iconpath/userauthentication.gif" alt="User Authentication" /></td></tr>      $last=$hostname;
       <tr>          }
        <td bgcolor="$mainbg"><br /><font size=-1><b>&nbsp;&nbsp;&nbsp;User Name:</b></font></td>          if ($spares) {
        <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>              $spares.= '<br />';
       </tr>          }
       <tr>          my %all_hostnames = &Apache::lonnet::all_hostnames();
        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;Password:</b></font></td>          foreach my $hostid (sort
        <td bgcolor="$mainbg"><input type="password" name="upass" size="10" /></td>      {
       </tr>   &Apache::lonnet::hostname($a) cmp
       <tr>      &Apache::lonnet::hostname($b);
        <td bgcolor="$mainbg"><font size=-1><b>&nbsp;&nbsp;&nbsp;Domain:</b></font></td>      }
        <td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td>      keys(%all_hostnames)) {
       </tr>              next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
       <tr>              my $hostname = &Apache::lonnet::hostname($hostid);
        <td bgcolor="$mainbg">&nbsp;&nbsp;&nbsp;<a href="/adm/loginproblems.html">Help</a></td>              next if (($last eq $hostname) || ($hostname eq ''));
        <td bgcolor="$mainbg" valign="bottom" align="center">              $spares.='<br /><a href="http://'.
         <br />               $hostname.
         <input type="submit" value="Log In" />               '/adm/login?domain='.$authdomain.'">'.
        </td>               $hostname.'</a>';
       </tr>              $last=$hostname;
      </table>           }
      <!-- End sub-table -->           $r->print(
     </form>     '<html>'
 ENDLOGIN    .'<head><title>'
     if ($fullgraph) {    .&mt('The LearningOnline Network with CAPA')
  $r->print(<<ENDDOCUMENT);    .'</title></head>'
    </td>    .'<body bgcolor="#FFFFFF">'
     .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
    <!-- Row 4 Column 2 -->    .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>    .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>');
           if ($spares) {
    <!-- Row 4 Column 4 -->              $r->print('<p>'.&mt('Please attempt to login to one of the following servers:')
    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>                       .'</p>'
   </tr>                       .$spares);
   <tr>          }
           $r->print('</body>'
    <!-- Row 5 Column 1 -->                   .'</html>'
    <td bgcolor="$sidebg" valign="middle" align="left">          );
      <br />          return OK;
      <table border=0 cellspacing=0 cellpadding=0>      }
       <tr>  
        <td bgcolor="$sidebg" align="left" valign="top">  # ----------------------------------------------- Apparently we are in business
         <small><b>&nbsp;&nbsp;&nbsp;Domain:&nbsp;</b></small>      $servadm=~s/\,/\<br \/\>/g;
        </td>  
        <td bgcolor="$sidebg" align="left" valign="top">  # ----------------------------------------------------------- Front page design
         <small><tt>&nbsp;$domain</tt></small>      my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);
        </td>      my $font=&Apache::loncommon::designparm('login.font',$domain);
       </tr>      my $link=&Apache::loncommon::designparm('login.link',$domain);
       <tr>      my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);
        <td bgcolor="$sidebg" align="left" valign="top">      my $alink=&Apache::loncommon::designparm('login.alink',$domain);
         <small><b>&nbsp;&nbsp;&nbsp;Server:&nbsp;</b></small>      my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);
        </td>      my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain);
        <td bgcolor="$sidebg" align="left" valign="top">      my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain);
         <small><tt>&nbsp;$lonhost ($role)</tt></small>      my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain);
        </td>      my $logo=&Apache::loncommon::designparm('login.logo',$domain);
       </tr>      my $img=&Apache::loncommon::designparm('login.img',$domain);
       <tr>      my $domainlogo=&Apache::loncommon::domainlogo($domain);
        <td bgcolor="$sidebg" align="left" valign="top">      my $showbanner = 1;
         <small><b>&nbsp;&nbsp;&nbsp;Load:&nbsp;</b></small>      my $showmainlogo = 1;
        </td>      if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
        <td bgcolor="$sidebg" align="left" valign="top">          $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
         <small><tt>&nbsp;$loadpercent percent</tt></small>      }
        </td>      if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
       </tr>          $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
      </table>      }
      <br />      my $showadminmail;
     <small>      my @possdoms = &Apache::lonnet::current_machine_domains();
      <b>&nbsp;&nbsp;&nbsp;System Administration:</b><br />      if (grep(/^\Q$domain\E$/,@possdoms)) {
      <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sysadm</tt><br />          $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
      <b>&nbsp;&nbsp;&nbsp;Server Administration:</b><br />      }
      <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$servadm<br />&nbsp;</tt>      my $showcoursecat =
     </small>          &Apache::loncommon::designparm('login.coursecatalog',$domain);
    </td>      my $shownewuserlink =
           &Apache::loncommon::designparm('login.newuser',$domain);
    <!-- Row 5 Column 2 -->      my $showhelpdesk =
    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>          &Apache::loncommon::designparm('login.helpdesk',$domain);
       my $now=time;
    <!-- Row 5 Column 3 -->      my $js = (<<ENDSCRIPT);
    <td width="100%" valign="bottom" bgcolor="$mainbg">  
 $domainlogo  <script type="text/javascript" language="JavaScript">
 </td>  // <![CDATA[
   function send()
    <!-- Row 5 Column 4 -->  {
    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>  this.document.server.elements.uname.value
   </tr>  =this.document.client.elements.uname.value;
   <tr>  
   this.document.server.elements.udom.value
    <!-- Row 6 Column 1 -->  =this.document.client.elements.udom.value;
    <td bgcolor="$sidebg">&nbsp;</td>  
   uextkey=this.document.client.elements.uextkey.value;
    <!-- Row 6 Column 2 -->  lextkey=this.document.client.elements.lextkey.value;
    <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>  initkeys();
   
    <!-- Row 6 Column 3 -->  if(this.document.server.action.substr(0,5) === 'http:'){
    <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" alt="" /></td>      this.document.server.elements.upass0.value
           =getCrypted(this.document.client.elements.upass$now.value);
    <!-- Row 6 Column 4 -->  } else {
    <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" alt="" /></td>      this.document.server.elements.upass0.value
   </tr>          =this.document.client.elements.upass$now.value;
  </table>  }
   
 <script>  this.document.client.elements.uname.value='';
 // the if prevents the script error if the browser can't handle this  this.document.client.elements.upass$now.value='';
 if ( document.client.uname ) { document.client.uname.focus(); }  
 </script>  this.document.server.submit();
   return false;
 ENDDOCUMENT  }
 }  
     $r->print('</body></html>');  function enableInput() {
     return OK;      this.document.client.elements.upass$now.removeAttribute("readOnly");
 }       this.document.client.elements.uname.removeAttribute("readOnly");
       this.document.client.elements.udom.removeAttribute("readOnly");
 1;      return;
 __END__  }
   
   // ]]>
   </script>
   
   ENDSCRIPT
   
   # --------------------------------------------------- Print login screen header
   
       my %add_entries = (
          bgcolor      => "$mainbg",
          text         => "$font",
          link         => "$link",
          vlink        => "$vlink",
          alink        => "$alink",
                  onload       => 'javascript:enableInput();',);
   
       my ($lonhost_in_use,$headextra,$headextra_exempt,@hosts,%defaultdomconf);
       @hosts = &Apache::lonnet::current_machine_ids();
       $lonhost_in_use = $lonhost;
       if (@hosts > 1) {
           foreach my $hostid (@hosts) {
               if (&Apache::lonnet::host_domain($hostid) eq $defdom) {
                   $lonhost_in_use = $hostid;
                   last;
               }
           }
       }
       %defaultdomconf = &Apache::loncommon::get_domainconf($defdom);
       $headextra = $defaultdomconf{$defdom.'.login.headtag_'.$lonhost_in_use};
       $headextra_exempt = $defaultdomconf{$domain.'.login.headtag_exempt_'.$lonhost_in_use};
       if ($headextra) {
           my $omitextra;
           if ($headextra_exempt ne '') {
               my @exempt = split(',',$headextra_exempt);
               my $ip = $ENV{'REMOTE_ADDR'};
               if (grep(/^\Q$ip\E$/,@exempt)) {
                   $omitextra = 1;
               }
           }
           unless ($omitextra) {
               my $confname = $defdom.'-domainconfig';
               if ($headextra =~ m{^\Q/res/$defdom/$confname/login/headtag/$lonhost_in_use/\E}) {
                   my $extra = &Apache::lonnet::getfile(&Apache::lonnet::filelocation("",$headextra));
                   unless ($extra eq '-1') {
                       $js .= "\n".$extra."\n";
                   }
               }
           }
       }
   
       $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
          { 'redirect'       => [$expire,'/adm/roles'],
    'add_entries' => \%add_entries,
    'only_body'   => 1,}));
   
   # ----------------------------------------------------------------------- Texts
   
       my %lt=&Apache::lonlocal::texthash(
             'un'       => 'Username',
             'pw'       => 'Password',
             'dom'      => 'Domain',
             'perc'     => 'percent',
             'load'     => 'Server Load',
             'userload' => 'User Load',
             'catalog'  => 'Course/Community Catalog',
             'log'      => 'Log in',
             'help'     => 'Log-in Help',
             'serv'     => 'Server',
             'servadm'  => 'Server Administration',
             'helpdesk' => 'Contact Helpdesk',
             'forgotpw' => 'Forgot password?',
             'newuser'  => 'New User?',
          );
   # -------------------------------------------------- Change password field name
   
       my $forgotpw = &forgotpwdisplay(%lt);
       $forgotpw .= '<br />' if $forgotpw;
       my $loginhelp = &Apache::lonauth::loginhelpdisplay($authdomain);
       if ($loginhelp) {
           $loginhelp = '<a href="'.$loginhelp.'">'.$lt{'help'}.'</a><br />';
       }
   
   # ---------------------------------------------------- Serve out DES JavaScript
       {
       my $jsh=Apache::File->new($include."/londes.js");
       $r->print(<$jsh>);
       }
   # ---------------------------------------------------------- Serve rest of page
   
       $r->print(
       '<div class="LC_Box"'
      .' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'
   );
   
       $r->print(<<ENDSERVERFORM);
   <form name="server" action="/adm/authenticate" method="post" target="_top">
      <input type="hidden" name="logtoken" value="$logtoken" />
      <input type="hidden" name="serverid" value="$lonhost" />
      <input type="hidden" name="uname" value="" />
      <input type="hidden" name="upass0" value="" />
      <input type="hidden" name="udom" value="" />
      <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
      <input type="hidden" name="localres" value="$env{'form.localres'}" />
     </form>
   ENDSERVERFORM
       my $coursecatalog;
       if (($showcoursecat eq '') || ($showcoursecat)) {
           $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';
       }
       my $newuserlink;
       if ($shownewuserlink) {
           $newuserlink = &newuser_link($lt{'newuser'}).'<br />';
       }
       my $logintitle =
           '<h2 class="LC_hcell"'
          .' style="background:'.$loginbox_header_bgcol.';'
          .' color:'.$loginbox_header_textcol.'">'
          .$lt{'log'}
          .'</h2>';
   
       my $noscript_warning='<noscript><span class="LC_warning"><b>'
                           .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
                           .'</b></span></noscript>';
       my $helpdeskscript;
       my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
                                          $authdomain,\$helpdeskscript,
                                          $showhelpdesk,\@possdoms);
   
       my $mobileargs;
       if ($clientmobile) {
           $mobileargs = 'autocapitalize="off" autocorrect="off"';
       }
       my $loginform=(<<LFORM);
   <form name="client" action="" onsubmit="return(send())">
     <input type="hidden" name="lextkey" value="$lextkey" />
     <input type="hidden" name="uextkey" value="$uextkey" />
     <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 />
     <input type="text" name="udom" id="udom" size="15" value="$authdomain" readonly="readonly" $mobileargs /><br />
     <input type="submit" value="$lt{'log'}" />
   </form>
   LFORM
   
       if ($showbanner) {
           $r->print(<<HEADER);
   <!-- The LON-CAPA Header -->
   <div style="background:$pgbg;margin:0;width:100%;">
     <img src="$img" border="0" alt="The Learning Online Network with CAPA" class="LC_maxwidth" />
   </div>
   HEADER
       }
       $r->print(<<ENDTOP);
   <div style="float:left;margin-top:0;">
   <div class="LC_Box" style="background:$loginbox_bg;">
     $logintitle
     $loginform
     $noscript_warning
   </div>
    
   <div class="LC_Box" style="padding-top: 10px;">
     $loginhelp
     $forgotpw
     $contactblock
     $newuserlink
     $coursecatalog
   </div>
   </div>
   
   <div>
   ENDTOP
       if ($showmainlogo) {
           $r->print(' <img src="'.$logo.'" alt="" class="LC_maxwidth" />'."\n");
       }
   $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) = @_;
       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 = $ENV{'REMOTE_ADDR'};
           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);
                   }
               }
           }
       }
       return $output;
   }
   
   sub redirect_page {
       my ($desthost,$path) = @_;
       my $protocol = $Apache::lonnet::protocol{$desthost};
       $protocol = 'http' if ($protocol ne 'https');
       unless ($path =~ m{^/}) {
           $path = '/'.$path;
       }
       my $url = $protocol.'://'.&Apache::lonnet::hostname($desthost).$path;
       if ($env{'form.firsturl'} ne '') {
           $url .='?firsturl='.$env{'form.firsturl'};
       }
       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.38  
changed lines
  Added in v.1.176


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.