Diff for /loncom/auth/lonlogin.pm between versions 1.137 and 1.162

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


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