Diff for /loncom/auth/lonlogin.pm between versions 1.140 and 1.169

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


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