Diff for /loncom/auth/lonlogin.pm between versions 1.113 and 1.175

version 1.113, 2008/12/15 11:44:46 version 1.175, 2018/12/02 14:55:59
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;  use LONCAPA;
    use CGI::Cookie();
 sub handler {   
     my $r = shift;  sub handler {
       my $r = shift;
     &Apache::loncommon::get_unprocessed_cgi  
  (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},      &Apache::loncommon::get_unprocessed_cgi
       $ENV{'REDIRECT_QUERY_STRING'}),   (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
  ['interface','username','domain','firsturl','localpath','localres',        $ENV{'REDIRECT_QUERY_STRING'}),
   'token']);   ['interface','username','domain','firsturl','localpath','localres',
     if (!defined($env{'form.firsturl'})) {    'token','role','symb','iptoken']);
         &Apache::lonacc::get_posted_cgi($r,['firsturl']);      if (!defined($env{'form.firsturl'})) {
     }          &Apache::lonacc::get_posted_cgi($r,['firsturl']);
       }
 # -- check if they are a migrating user      if (!defined($env{'form.firsturl'})) {
     if (defined($env{'form.token'})) {          if ($ENV{'REDIRECT_URL'} =~ m{^/+tiny/+$LONCAPA::match_domain/+\w+$}) {
  return &Apache::migrateuser::handler($r);              $env{'form.firsturl'} = $ENV{'REDIRECT_URL'};
     }          }
       }
     &Apache::loncommon::no_cache($r);  
     &Apache::lonlocal::get_language_handle($r);  # -- check if they are a migrating user
     &Apache::loncommon::content_type($r,'text/html');      if (defined($env{'form.token'})) {
     $r->send_http_header;   return &Apache::migrateuser::handler($r);
     return OK if $r->header_only;      }
   
   # For "public user" - remove any exising "public" cookie, as user really wants to log-in
 # Are we re-routing?      my ($handle,$lonidsdir,$expirepub,$userdom);
     if (-e '/home/httpd/html/lon-status/reroute.txt') {      unless ($r->header_only) {
  &Apache::lonauth::reroute($r);          $handle = &Apache::lonnet::check_for_valid_session($r,'lonID',undef,\$userdom);
  return OK;          if ($handle ne '') {
     }              $lonidsdir=$r->dir_config('lonIDsDir');
               if ($handle=~/^publicuser\_/) {
                   unlink($r->dir_config('lonIDsDir')."/$handle.id");
 # -------------------------------- Prevent users from attempting to login twice                  undef($handle);
     my $handle = &Apache::lonnet::check_for_valid_session($r);                  undef($userdom);
     if ($handle=~/^publicuser\_/) {                  $expirepub = 1;
 # For "public user" - remove it, we apparently really want to login              }
  unlink($r->dir_config('lonIDsDir')."/$handle.id");          }
     } elsif ($handle ne '') {      }
 # Indeed, a valid token is found  
  my $start_page =       &Apache::loncommon::no_cache($r);
     &Apache::loncommon::start_page('Already logged in');      &Apache::lonlocal::get_language_handle($r);
  my $end_page =       &Apache::loncommon::content_type($r,'text/html');
     &Apache::loncommon::end_page();      if ($expirepub) {
  $r->print(          my $c = new CGI::Cookie(-name    => 'lonPubID',
                   $start_page                                  -value   => '',
                  .'<h1>'.&mt('You are already logged in!').'</h1>'                                  -expires => '-10y',);
                  .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]logout[_4].',          $r->header_out('Set-cookie' => $c);
                   '<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>').'</p>'      } elsif (($handle eq '') && ($userdom ne '')) {
                  .'<p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'          my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
                  .$end_page          foreach my $name (keys(%cookies)) {
                  );              next unless ($name =~ /^lon(|S|Link|Pub)ID$/);
         return OK;              my $c = new CGI::Cookie(-name    => $name,
     }                                      -value   => '',
                                       -expires => '-10y',);
 # ---------------------------------------------------- No valid token, continue              $r->headers_out->add('Set-cookie' => $c);
           }
  # ---------------------------- Not possible to really login to domain "public"      }
     if ($env{'form.domain'} eq 'public') {      $r->send_http_header;
  $env{'form.domain'}='';      return OK if $r->header_only;
  $env{'form.username'}='';  
     }  
 # ----------------------------------------------------------- Process Interface  # Are we re-routing?
     $env{'form.interface'}=~s/\W//g;      my $londocroot = $r->dir_config('lonDocRoot');
       if (-e "$londocroot/lon-status/reroute.txt") {
     my $httpbrowser=$ENV{"HTTP_USER_AGENT"};   &Apache::lonauth::reroute($r);
        return OK;
     my $fullgraph=($env{'form.interface'} ne 'textual');      }
   
     my $iconpath=       $env{'form.firsturl'} =~ s/(`)/'/g;
  &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));  
   # Check if browser sent a LON-CAPA load balancer cookie (and this is a balancer)
     my $domain = &Apache::lonnet::default_login_domain();  
     if (($env{'form.domain'}) &&       my ($found_server,$balancer_cookie) = &Apache::lonnet::check_for_balancer_cookie($r,1);
  (&Apache::lonnet::domain($env{'form.domain'},'description'))) {      if ($found_server) {
  $domain=$env{'form.domain'};          my $hostname = &Apache::lonnet::hostname($found_server);
     }          if ($hostname ne '') {
     my $role    = $r->dir_config('lonRole');              my $protocol = $Apache::lonnet::protocol{$found_server};
     my $loadlim = $r->dir_config('lonLoadLim');              $protocol = 'http' if ($protocol ne 'https');
     my $servadm = $r->dir_config('lonAdmEMail');              my $dest = '/adm/roles';
     my $lonhost = $r->dir_config('lonHostID');              if ($env{'form.firsturl'} ne '') {
     my $tabdir  = $r->dir_config('lonTabDir');                  $dest = $env{'form.firsturl'};
     my $include = $r->dir_config('lonIncludes');              }
     my $expire  = $r->dir_config('lonExpire');              my $url = $protocol.'://'.$hostname.$dest;
     my $version = $r->dir_config('lonVersion');              my $start_page =
     my $host_name = &Apache::lonnet::hostname($lonhost);                  &Apache::loncommon::start_page('Switching Server ...',undef,
                                                  {'redirect'       => [0,$url],});
 # --------------------------------------------- Default values for login fields              my $end_page   = &Apache::loncommon::end_page();
               $r->print($start_page.$end_page);
     my $authusername=($env{'form.username'}?$env{'form.username'}:'');              return OK;
     my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);          }
       }
 # ---------------------------------------------------------- Determine own load  
     my $loadavg;  #
     {  # If browser sent an old cookie for which the session file had been removed
  my $loadfile=Apache::File->new('/proc/loadavg');  # check if configuration for user's domain has a portal URL set.  If so
  $loadavg=<$loadfile>;  # switch user's log-in to the portal.
     }  #
     $loadavg =~ s/\s.*//g;  
     my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);      if (($handle eq '') && ($userdom ne '')) {
     my $userloadpercent=&Apache::lonnet::userload();          my %domdefaults = &Apache::lonnet::get_domain_defaults($userdom);
           if ($domdefaults{'portal_def'} =~ /^https?\:/) {
 # ------------------------------------------------------- Do the load balancing              my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
     my $otherserver= &Apache::lonnet::absolute_url($host_name);                                            {'redirect' => [0,$domdefaults{'portal_def'}],});
     my $firsturl=              my $end_page   = &Apache::loncommon::end_page();
     ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});              $r->print($start_page.$end_page);
 # ---------------------------------------------------------- Are we overloaded?              return OK;
     if ((($userloadpercent>100.0)||($loadpercent>100.0))) {          }
         my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);      }
  if ($unloaded) { $otherserver=$unloaded; }  
     }  # -------------------------------- Prevent users from attempting to login twice
       if ($handle ne '') {
 # ----------------------------------------------------------- Get announcements          &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
     my $announcements=&Apache::lonnet::getannounce();   my $start_page =
 # -------------------------------------------------------- Set login parameters      &Apache::loncommon::start_page('Already logged in');
    my $end_page =
     my @hexstr=('0','1','2','3','4','5','6','7',      &Apache::loncommon::end_page();
                 '8','9','a','b','c','d','e','f');          my $dest = '/adm/roles';
     my $lkey='';          if ($env{'form.firsturl'} ne '') {
     for (0..7) {              $dest = $env{'form.firsturl'};
         $lkey.=$hexstr[rand(15)];          }
     }   $r->print(
                     $start_page
     my $ukey='';                   .'<p class="LC_warning">'.&mt('You are already logged in!').'</p>'
     for (0..7) {                   .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
         $ukey.=$hexstr[rand(15)];                    '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
     }                   .$end_page
                    );
     my $lextkey=hex($lkey);          return OK;
     if ($lextkey>2147483647) { $lextkey-=4294967296; }      }
   
     my $uextkey=hex($ukey);  # ---------------------------------------------------- No valid token, continue
     if ($uextkey>2147483647) { $uextkey-=4294967296; }  
   # ---------------------------- Not possible to really login to domain "public"
 # -------------------------------------------------------- Store away log token      if ($env{'form.domain'} eq 'public') {
     my $logtoken=Apache::lonnet::reply(   $env{'form.domain'}='';
        'tmpput:'.$ukey.$lkey.'&'.$firsturl,   $env{'form.username'}='';
        $lonhost);      }
   
 # ------------------- If we cannot talk to ourselves, we are in serious trouble  # ------ Is this page requested because /adm/migrateuser detected an IP change?
       my %sessiondata;
     if ($logtoken eq 'con_lost') {      if ($env{'form.iptoken'}) {
         my $spares='';          %sessiondata = &Apache::lonnet::tmpget($env{'form.iptoken'});
  my $last;          unless ($sessiondata{'sessionserver'}) {
         foreach my $hostid (sort              my $delete = &Apache::lonnet::tmpdel($env{'form.iptoken'});
     {              delete($env{'form.iptoken'});
  &Apache::lonnet::hostname($a) cmp          }
     &Apache::lonnet::hostname($b);      }
     }  # ----------------------------------------------------------- Process Interface
     keys(%Apache::lonnet::spareid)) {      $env{'form.interface'}=~s/\W//g;
             next if ($hostid eq $lonhost);  
     my $hostname = &Apache::lonnet::hostname($hostid);      (undef,undef,undef,undef,undef,undef,my $clientmobile) =
     next if ($last eq $hostname);          &Apache::loncommon::decode_user_agent();
             $spares.='<br /><font size="+1"><a href="http://'.  
                 $hostname.      my $iconpath=
                 '/adm/login?domain='.$authdomain.'">'.   &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
                 $hostname.'</a>'.  
                 ' '.&mt('(preferred)').'</font>'.$/;      my $lonhost = $r->dir_config('lonHostID');
     $last=$hostname;      my $domain = &Apache::lonnet::default_login_domain();
         }      my $defdom = $domain;
 $spares.= '<br />';      if ($lonhost ne '') {
 my %all_hostnames = &Apache::lonnet::all_hostnames();          unless ($sessiondata{'sessionserver'}) {
 foreach my $hostid (sort              my $redirect = &check_loginvia($domain,$lonhost);
     {              if ($redirect) {
  &Apache::lonnet::hostname($a) cmp                  $r->print($redirect);
     &Apache::lonnet::hostname($b);                  return OK;
     }              }
     keys(%all_hostnames)) {          }
     next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});      }
     my $hostname = &Apache::lonnet::hostname($hostid);  
     next if ($last eq $hostname);      if (($sessiondata{'domain'}) &&
     $spares.='<br /><a href="http://'.          (&Apache::lonnet::domain($sessiondata{'domain'},'description'))) {
  $hostname.          $domain=$sessiondata{'domain'};
  '/adm/login?domain='.$authdomain.'">'.      } elsif (($env{'form.domain'}) &&
  $hostname.'</a>';   (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
     $last=$hostname;   $domain=$env{'form.domain'};
 }      }
 $r->print(  
    '<html>'      my $role    = $r->dir_config('lonRole');
   .'<head><title>'      my $loadlim = $r->dir_config('lonLoadLim');
   .&mt('The LearningOnline Network with CAPA')      my $uloadlim= $r->dir_config('lonUserLoadLim');
   .'</title></head>'      my $servadm = $r->dir_config('lonAdmEMail');
   .'<body bgcolor="#FFFFFF">'      my $tabdir  = $r->dir_config('lonTabDir');
   .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'      my $include = $r->dir_config('lonIncludes');
   .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'      my $expire  = $r->dir_config('lonExpire');
   .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>'      my $version = $r->dir_config('lonVersion');
   .'<p>'.&mt('Please attempt to login to one of the following servers:').'</p>'      my $host_name = &Apache::lonnet::hostname($lonhost);
   .$spares  
   .'</body>'  # --------------------------------------------- Default values for login fields
   .'</html>'     
 );      my ($authusername,$authdomain);
 return OK;      if ($sessiondata{'username'}) {
 }          $authusername=$sessiondata{'username'};
       } else {
 # ----------------------------------------------- Apparently we are in business          $env{'form.username'} = &Apache::loncommon::cleanup_html($env{'form.username'});
 $servadm=~s/\,/\<br \/\>/g;          $authusername=($env{'form.username'}?$env{'form.username'}:'');
       }
 # ----------------------------------------------------------- Front page design      if ($sessiondata{'domain'}) {
 my $pgbg=          $authdomain=$sessiondata{'domain'};
 ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');      } else {
 my $font=          $env{'form.domain'} = &Apache::loncommon::cleanup_html($env{'form.domain'});
 ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');          $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
 my $link=      }
 ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');  
 my $vlink=  # ---------------------------------------------------------- Determine own load
 ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');      my $loadavg;
 my $alink=&Apache::loncommon::designparm('login.alink',$domain);      {
 my $mainbg=   my $loadfile=Apache::File->new('/proc/loadavg');
 ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');   $loadavg=<$loadfile>;
 my $logo=&Apache::loncommon::designparm('login.logo',$domain);      }
 my $img=&Apache::loncommon::designparm('login.img',$domain);      $loadavg =~ s/\s.*//g;
 my $domainlogo=&Apache::loncommon::domainlogo($domain);  
 my $login=&Apache::loncommon::designparm('login.login',$domain);      my ($loadpercent,$userloadpercent);
 if ($login eq '') {      if ($loadlim) {
 $login = $iconpath.'/'.&mt('userauthentication.gif');          $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
 }      }
 my $showbanner = 1;      if ($uloadlim) {
 my $showmainlogo = 1;          $userloadpercent=&Apache::lonnet::userload();
 if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {      }
     $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);  
 }      my $firsturl=
 if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {      ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
     $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);  
 }  # ----------------------------------------------------------- Get announcements
 my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);      my $announcements=&Apache::lonnet::getannounce();
 my $showcoursecat =  # -------------------------------------------------------- Set login parameters
 &Apache::loncommon::designparm('login.coursecatalog',$domain);  
 my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);      my @hexstr=('0','1','2','3','4','5','6','7',
 my $shownewuserlink =                   '8','9','a','b','c','d','e','f');
 &Apache::loncommon::designparm('login.newuser',$domain);      my $lkey='';
 my $now=time;      for (0..7) {
 my $js = (<<ENDSCRIPT);          $lkey.=$hexstr[rand(15)];
       }
 <script language="JavaScript">  
 function send()      my $ukey='';
 {      for (0..7) {
 this.document.server.elements.uname.value          $ukey.=$hexstr[rand(15)];
 =this.document.client.elements.uname.value;      }
   
 this.document.server.elements.udom.value      my $lextkey=hex($lkey);
 =this.document.client.elements.udom.value;      if ($lextkey>2147483647) { $lextkey-=4294967296; }
   
 uextkey=this.document.client.elements.uextkey.value;      my $uextkey=hex($ukey);
 lextkey=this.document.client.elements.lextkey.value;      if ($uextkey>2147483647) { $uextkey-=4294967296; }
 initkeys();  
   # -------------------------------------------------------- Store away log token
 this.document.server.elements.upass0.value      my $tokenextras;
     =crypted(this.document.client.elements.upass$now.value.substr(0,15));      if ($env{'form.role'}) {
 this.document.server.elements.upass1.value          $tokenextras = '&role='.&escape($env{'form.role'});
     =crypted(this.document.client.elements.upass$now.value.substr(15,15));      }
 this.document.server.elements.upass2.value      if ($env{'form.symb'}) {
     =crypted(this.document.client.elements.upass$now.value.substr(30,15));          if (!$tokenextras) {
               $tokenextras = '&';
 this.document.client.elements.uname.value='';          }
 this.document.client.elements.upass$now.value='';          $tokenextras .= '&symb='.&escape($env{'form.symb'});
       }
 this.document.server.submit();      if ($env{'form.iptoken'}) {
 return false;          if (!$tokenextras) {
 }              $tokenextras = '&&';
 </script>          }
           $tokenextras .= '&iptoken='.&escape($env{'form.iptoken'});
 ENDSCRIPT      }
       my $logtoken=Apache::lonnet::reply(
 # --------------------------------------------------- Print login screen header         'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
          $lonhost);
 my %add_entries = (topmargin    => "0",  
        leftmargin   => "0",  # -- If we cannot talk to ourselves, or hostID does not map to a hostname
        marginheight => "0",  #    we are in serious trouble
        marginwidth  => "0",  
        bgcolor      => "$mainbg",      if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {
        text         => "$font",          if ($logtoken eq 'no_such_host') {
        link         => "$link",              &Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab');
        vlink        => "$vlink",          }
        alink        => "$alink",);          my $spares='';
    my $last;
 $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,          foreach my $hostid (sort
        { 'redirect'       => [$expire,'/adm/roles'],       {
  'add_entries' => \%add_entries,   &Apache::lonnet::hostname($a) cmp
  'only_body'   => 1,}));      &Apache::lonnet::hostname($b);
       }
 # ----------------------------------------------------------------------- Texts      keys(%Apache::lonnet::spareid)) {
               next if ($hostid eq $lonhost);
 my %lt=&Apache::lonlocal::texthash(      my $hostname = &Apache::lonnet::hostname($hostid);
   'un'  => 'Username',      next if (($last eq $hostname) || ($hostname eq ''));
   'pw'  => 'Password',              $spares.='<br /><font size="+1"><a href="http://'.
   'dom' => 'Domain',                  $hostname.
   'perc' => 'percent',                  '/adm/login?domain='.$authdomain.'">'.
   'load' => 'Server Load',                  $hostname.'</a>'.
   'userload' => 'User Load',                  ' '.&mt('(preferred)').'</font>'.$/;
   'about'  => 'About LON-CAPA',      $last=$hostname;
   'catalog' => 'Course Catalog',          }
   'log' => 'Log in',          if ($spares) {
   'help' => 'Log-in Help',              $spares.= '<br />';
   'serv' => 'Server',          }
   'servadm' => 'Server Administration',          my %all_hostnames = &Apache::lonnet::all_hostnames();
   'helpdesk' => 'Contact Helpdesk',          foreach my $hostid (sort
   'forgotpw' => 'Forgot password?',      {
   'newuser'  => 'New User?',   &Apache::lonnet::hostname($a) cmp
   );      &Apache::lonnet::hostname($b);
 # -------------------------------------------------- Change password field name      }
 my $forgotpw = &forgotpwdisplay(%lt);      keys(%all_hostnames)) {
 my $loginhelp = &loginhelpdisplay(%lt);              next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
               my $hostname = &Apache::lonnet::hostname($hostid);
 # ---------------------------------------------------- Serve out DES JavaScript              next if (($last eq $hostname) || ($hostname eq ''));
 {              $spares.='<br /><a href="http://'.
 my $jsh=Apache::File->new($include."/londes.js");               $hostname.
 $r->print(<$jsh>);               '/adm/login?domain='.$authdomain.'">'.
 }               $hostname.'</a>';
 # ---------------------------------------------------------- Serve rest of page              $last=$hostname;
            }
 if ($fullgraph) {           $r->print(
 $r->print(     '<html>'
   '<div class="LC_loginpage_container">');    .'<head><title>'
 }    .&mt('The LearningOnline Network with CAPA')
     .'</title></head>'
 $r->print(<<ENDSERVERFORM);    .'<body bgcolor="#FFFFFF">'
 <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">    .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
    <input type="hidden" name="logtoken" value="$logtoken" />    .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
    <input type="hidden" name="serverid" value="$lonhost" />    .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>');
    <input type="hidden" name="uname" value="" />          if ($spares) {
    <input type="hidden" name="upass0" value="" />              $r->print('<p>'.&mt('Please attempt to login to one of the following servers:')
    <input type="hidden" name="upass1" value="" />                       .'</p>'
    <input type="hidden" name="upass2" value="" />                       .$spares);
    <input type="hidden" name="udom" value="" />          }
    <input type="hidden" name="localpath" value="$env{'form.localpath'}" />          $r->print('</body>'
    <input type="hidden" name="localres" value="$env{'form.localres'}" />                   .'</html>'
   </form>          );
 ENDSERVERFORM          return OK;
 my $coursecatalog;      }
 if (($showcoursecat eq '') || ($showcoursecat)) {  
     $coursecatalog = &coursecatalog_link($lt{'catalog'});  # ----------------------------------------------- Apparently we are in business
 }      $servadm=~s/\,/\<br \/\>/g;
 my $newuserlink;  
 if ($shownewuserlink) {  # ----------------------------------------------------------- Front page design
     $newuserlink = &newuser_link($lt{'newuser'});      my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);
 }      my $font=&Apache::loncommon::designparm('login.font',$domain);
 my $logintitle;      my $link=&Apache::loncommon::designparm('login.link',$domain);
 if ($loginheader eq 'text') {      my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);
     $logintitle ='<h2>'.$lt{'log'}.'</h2>';      my $alink=&Apache::loncommon::designparm('login.alink',$domain);
 } else {      my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);
     $logintitle = '<img src="'.$login.'" alt="'.      my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain);
                   &mt('User Authentication').'" />';      my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain);
 }      my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain);
       my $logo=&Apache::loncommon::designparm('login.logo',$domain);
 my $noscript_warning='<noscript><span class="LC_warning"><b>'      my $img=&Apache::loncommon::designparm('login.img',$domain);
                      .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')      my $domainlogo=&Apache::loncommon::domainlogo($domain);
                     .'</b></span></noscript>';      my $showbanner = 1;
 my $helpdeskscript;      my $showmainlogo = 1;
 my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,      if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
                             $version,$authdomain,\$helpdeskscript);          $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
       }
 my $loginform=(<<LFORM);      if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
 <form name="client" onsubmit="return(send())">          $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
   <input type="hidden" name="lextkey" value="$lextkey">      }
   <input type="hidden" name="uextkey" value="$uextkey">      my $showadminmail;
   <b><label for="uname">$lt{'un'}</label>:</b><br />      my @possdoms = &Apache::lonnet::current_machine_domains();
   <input type="text" name="uname" size="15" value="$authusername" /><br />      if (grep(/^\Q$domain\E$/,@possdoms)) {
   <b><label for="upass$now">$lt{'pw'}</label>:</b><br />          $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
   <input type="password" name="upass$now" size="15" /><br />      }
   <b><label for="udom">$lt{'dom'}</label>:</b><br />      my $showcoursecat =
   <input type="text" name="udom" size="15" value="$authdomain" /><br />          &Apache::loncommon::designparm('login.coursecatalog',$domain);
   <input type="submit" value="$lt{'log'}" />      my $shownewuserlink =
 </form>          &Apache::loncommon::designparm('login.newuser',$domain);
 LFORM      my $showhelpdesk =
           &Apache::loncommon::designparm('login.helpdesk',$domain);
 if ($fullgraph) {      my $now=time;
     if ($showbanner) {      my $js = (<<ENDSCRIPT);
         $r->print(<<HEADER);  
 <!-- The LON-CAPA Header -->  <script type="text/javascript" language="JavaScript">
 <table border="0" align="left" width="100%" cellspacing="0" cellpadding="1">  // <![CDATA[
  <tr>  function send()
   <td align="left" valign="top" bgcolor="$pgbg">  {
       <img src="$img" border=0 alt="The Learning Online Network with CAPA" />  this.document.server.elements.uname.value
   </td>  =this.document.client.elements.uname.value;
  </tr>  
 </table>  this.document.server.elements.udom.value
 HEADER  =this.document.client.elements.udom.value;
     }  
     if ($showmainlogo) {  uextkey=this.document.client.elements.uextkey.value;
         $r->print('<div class="LC_loginpage_space">&nbsp;</div>'."\n".  lextkey=this.document.client.elements.lextkey.value;
                   '    <img src="'.$logo.'" alt="" />'."\n");  initkeys();
     }  
     $r->print(<<ENDTOP);  if(this.document.server.action.substr(0,5) === 'http:'){
 <div class="LC_loginpage_loginDomain">$domainlogo</div>      this.document.server.elements.upass0.value
 <div class="LC_loginpage_loginContainer">          =getCrypted(this.document.client.elements.upass$now.value);
   $logintitle  } else {
    <table border="0" align="left" cellspacing="1" cellpadding="2" width="100%">      this.document.server.elements.upass0.value
       <tr>          =this.document.client.elements.upass$now.value;
    <td>  }
  $loginform  
            </td>  this.document.client.elements.uname.value='';
       </tr>  this.document.client.elements.upass$now.value='';
    </table>    
    $noscript_warning  this.document.server.submit();
 </div>  return false;
     }
 <div class="LC_loginpage_loginInfo">  
         $loginhelp<br />  function enableInput() {
         $forgotpw<br /><br />      this.document.client.elements.upass$now.removeAttribute("readOnly");
         $newuserlink<br />      this.document.client.elements.uname.removeAttribute("readOnly");
         $coursecatalog<br /><br />      this.document.client.elements.udom.removeAttribute("readOnly");
         <a href="/adm/about.html"><b>$lt{'about'}</b></a><br/>      return;
  $contactblock  }
 </div>  
   // ]]>
 <div class="LC_loginpage_space">&nbsp;</div>  </script>
 $announcements  
 ENDTOP  ENDSCRIPT
 }  
   # --------------------------------------------------- Print login screen header
 if($announcements){$r->print('<div class="LC_loginpage_space">&nbsp;</div>');}  
       my %add_entries = (
 if ($fullgraph) {         bgcolor      => "$mainbg",
 $r->print(<<ENDDOCUMENT);         text         => "$font",
      <table border=0 cellspacing=0 cellpadding=0>         link         => "$link",
       <tr>         vlink        => "$vlink",
        <td  align="left" valign="top">         alink        => "$alink",
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>                 onload       => 'javascript:enableInput();',);
        </td>  
        <td  align="left" valign="top">      my ($lonhost_in_use,$headextra,$headextra_exempt,@hosts,%defaultdomconf);
         <small><tt>&nbsp;$domain</tt></small>      @hosts = &Apache::lonnet::current_machine_ids();
        </td>      $lonhost_in_use = $lonhost;
       </tr>      if (@hosts > 1) {
       <tr>          foreach my $hostid (@hosts) {
        <td  align="left" valign="top">              if (&Apache::lonnet::host_domain($hostid) eq $defdom) {
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>                  $lonhost_in_use = $hostid;
        </td>                  last;
        <td align="left" valign="top">              }
         <small><tt>&nbsp;$lonhost ($role)</tt></small>          }
        </td>      }
       </tr>      %defaultdomconf = &Apache::loncommon::get_domainconf($defdom);
       <tr>      $headextra = $defaultdomconf{$defdom.'.login.headtag_'.$lonhost_in_use};
        <td align="left" valign="top">      $headextra_exempt = $defaultdomconf{$domain.'.login.headtag_exempt_'.$lonhost_in_use};
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>      if ($headextra) {
        </td>          my $omitextra;
        <td align="left" valign="top">          if ($headextra_exempt ne '') {
         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>              my @exempt = split(',',$headextra_exempt);
        </td>              my $ip = $ENV{'REMOTE_ADDR'};
       </tr>              if (grep(/^\Q$ip\E$/,@exempt)) {
       <tr>                  $omitextra = 1;
        <td align="left" valign="top">              }
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>          }
        </td>          unless ($omitextra) {
        <td align="left" valign="top">              my $confname = $defdom.'-domainconfig';
         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>              if ($headextra =~ m{^\Q/res/$defdom/$confname/login/headtag/$lonhost_in_use/\E}) {
        </td>                  my $extra = &Apache::lonnet::getfile(&Apache::lonnet::filelocation("",$headextra));
       </tr>                  unless ($extra eq '-1') {
      </table>                      $js .= "\n".$extra."\n";
  </div>                  }
               }
 <script type="text/javascript">          }
 // the if prevents the script error if the browser can not handle this      }
 if ( document.client.uname ) { document.client.uname.focus(); }  
 </script>      $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
 $helpdeskscript         { 'redirect'       => [$expire,'/adm/roles'],
    'add_entries' => \%add_entries,
 ENDDOCUMENT   'only_body'   => 1,}));
 }  
     my %endargs = ( 'noredirectlink' => 1, );  # ----------------------------------------------------------------------- Texts
     $r->print(&Apache::loncommon::end_page(\%endargs));  
     return OK;      my %lt=&Apache::lonlocal::texthash(
 }            'un'       => 'Username',
             'pw'       => 'Password',
 sub contactdisplay {            'dom'      => 'Domain',
     my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;            'perc'     => 'percent',
     my $contactblock;            'load'     => 'Server Load',
     my $showhelpdesk = 0;            'userload' => 'User Load',
     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};            'catalog'  => 'Course/Community Catalog',
     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {            'log'      => 'Log in',
         $showhelpdesk = 1;            'help'     => 'Log-in Help',
     }            'serv'     => 'Server',
     if ($servadm && $showadminmail) {            'servadm'  => 'Server Administration',
         $contactblock .= '<b>&nbsp;&nbsp;&nbsp;'.$$lt{'servadm'}.':</b><br />'.            'helpdesk' => 'Contact Helpdesk',
                          '<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$servadm.'</tt><br />&nbsp;<br />';            'forgotpw' => 'Forgot password?',
     }            'newuser'  => 'New User?',
     if ($showhelpdesk) {         );
         $contactblock .= '<b><a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a></b><br />';  # -------------------------------------------------- Change password field name
         my $thisurl = &escape('/adm/login');  
         $$helpdeskscript = <<"ENDSCRIPT";      my $forgotpw = &forgotpwdisplay(%lt);
 <script type="text/javascript">      $forgotpw .= '<br />' if $forgotpw;
 function helpdesk() {      my $loginhelp = &Apache::lonauth::loginhelpdisplay($authdomain);
     var codedom = document.client.udom.value;      if ($loginhelp) {
     if (codedom == '') {          $loginhelp = '<a href="'.$loginhelp.'">'.$lt{'help'}.'</a><br />';
         codedom = "$authdomain";      }
     }  
     var querystr = "origurl=$thisurl&codedom="+codedom;  # ---------------------------------------------------- Serve out DES JavaScript
     document.location.href = "/adm/helpdesk?"+querystr;      {
     return;      my $jsh=Apache::File->new($include."/londes.js");
 }      $r->print(<$jsh>);
 </script>      }
 ENDSCRIPT  # ---------------------------------------------------------- Serve rest of page
     }  
     $contactblock .= <<"ENDBLOCK";      $r->print(
      &nbsp;&nbsp;&nbsp;$version      '<div class="LC_Box"'
 ENDBLOCK     .' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'
     return $contactblock;  );
 }  
       $r->print(<<ENDSERVERFORM);
 sub forgotpwdisplay {  <form name="server" action="/adm/authenticate" method="post" target="_top">
     my (%lt) = @_;     <input type="hidden" name="logtoken" value="$logtoken" />
     my $prompt_for_resetpw = 1;      <input type="hidden" name="serverid" value="$lonhost" />
     if ($prompt_for_resetpw) {     <input type="hidden" name="uname" value="" />
         return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';     <input type="hidden" name="upass0" value="" />
     }     <input type="hidden" name="udom" value="" />
     return;     <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
 }     <input type="hidden" name="localres" value="$env{'form.localres'}" />
     </form>
 sub loginhelpdisplay {  ENDSERVERFORM
     my (%lt) = @_;      my $coursecatalog;
     my $login_help = 1;      if (($showcoursecat eq '') || ($showcoursecat)) {
     if ($login_help) {          $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';
         return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';      }
     }      my $newuserlink;
     return;      if ($shownewuserlink) {
 }          $newuserlink = &newuser_link($lt{'newuser'}).'<br />';
       }
 sub coursecatalog_link {      my $logintitle =
     my ($linkname) = @_;          '<h2 class="LC_hcell"'
     return <<"END";         .' style="background:'.$loginbox_header_bgcol.';'
       <a href="/adm/coursecatalog">$linkname</a>         .' color:'.$loginbox_header_textcol.'">'
 END         .$lt{'log'}
 }         .'</h2>';
   
 sub newuser_link {      my $noscript_warning='<noscript><span class="LC_warning"><b>'
     my ($linkname) = @_;                          .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
     return '&nbsp;&nbsp;&nbsp;<a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';                          .'</b></span></noscript>';
 }      my $helpdeskscript;
       my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
 1;                                         $authdomain,\$helpdeskscript,
 __END__                                         $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) = @_;
       if ($domain eq '' || $lonhost 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 '') {
                       $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.113  
changed lines
  Added in v.1.175


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