Diff for /loncom/auth/lonlogin.pm between versions 1.135 and 1.170

version 1.135, 2010/03/17 14:37:43 version 1.170, 2017/02/25 19:56:09
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    => 'lonPubID',
     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();          }
       }
 # ------------------------------------------------------- Do the load balancing  
     my $otherserver= &Apache::lonnet::absolute_url($host_name);      if (($sessiondata{'domain'}) &&
     my $firsturl=          (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
     ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});          $domain=$sessiondata{'domain'};
 # ---------------------------------------------------------- Are we overloaded?      } elsif (($env{'form.domain'}) &&
     if ((($userloadpercent>100.0)||($loadpercent>100.0))) {   (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
         my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);   $domain=$env{'form.domain'};
  if ($unloaded) { $otherserver=$unloaded; }      }
     }  
       my $role    = $r->dir_config('lonRole');
 # ----------------------------------------------------------- Get announcements      my $loadlim = $r->dir_config('lonLoadLim');
     my $announcements=&Apache::lonnet::getannounce();      my $uloadlim= $r->dir_config('lonUserLoadLim');
 # -------------------------------------------------------- Set login parameters      my $servadm = $r->dir_config('lonAdmEMail');
       my $tabdir  = $r->dir_config('lonTabDir');
     my @hexstr=('0','1','2','3','4','5','6','7',      my $include = $r->dir_config('lonIncludes');
                 '8','9','a','b','c','d','e','f');      my $expire  = $r->dir_config('lonExpire');
     my $lkey='';      my $version = $r->dir_config('lonVersion');
     for (0..7) {      my $host_name = &Apache::lonnet::hostname($lonhost);
         $lkey.=$hexstr[rand(15)];  
     }  # --------------------------------------------- Default values for login fields
      
     my $ukey='';      my ($authusername,$authdomain);
     for (0..7) {      if ($sessiondata{'username'}) {
         $ukey.=$hexstr[rand(15)];          $authusername=$sessiondata{'username'};
     }      } else {
           $env{'form.username'} = &Apache::loncommon::cleanup_html($env{'form.username'});
     my $lextkey=hex($lkey);          $authusername=($env{'form.username'}?$env{'form.username'}:'');
     if ($lextkey>2147483647) { $lextkey-=4294967296; }      }
       if ($sessiondata{'domain'}) {
     my $uextkey=hex($ukey);          $authdomain=$sessiondata{'domain'};
     if ($uextkey>2147483647) { $uextkey-=4294967296; }      } else {
           $env{'form.domain'} = &Apache::loncommon::cleanup_html($env{'form.domain'});
 # -------------------------------------------------------- Store away log token          $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
     my $tokenextras;      }
     if ($env{'form.role'}) {  
         $tokenextras = '&role='.&escape($env{'form.role'});  # ---------------------------------------------------------- Determine own load
     }      my $loadavg;
     if ($env{'form.symb'}) {      {
         if (!$tokenextras) {   my $loadfile=Apache::File->new('/proc/loadavg');
             $tokenextras = '&';   $loadavg=<$loadfile>;
         }      }
         $tokenextras .= '&symb='.&escape($env{'form.symb'});      $loadavg =~ s/\s.*//g;
     }  
     my $logtoken=Apache::lonnet::reply(      my ($loadpercent,$userloadpercent);
        'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,      if ($loadlim) {
        $lonhost);          $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
       }
 # ------------------- If we cannot talk to ourselves, we are in serious trouble      if ($uloadlim) {
           $userloadpercent=&Apache::lonnet::userload();
     if ($logtoken eq 'con_lost') {      }
         my $spares='';  
  my $last;      my $firsturl=
         foreach my $hostid (sort      ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
     {  
  &Apache::lonnet::hostname($a) cmp  # ----------------------------------------------------------- Get announcements
     &Apache::lonnet::hostname($b);      my $announcements=&Apache::lonnet::getannounce();
     }  # -------------------------------------------------------- Set login parameters
     keys(%Apache::lonnet::spareid)) {  
             next if ($hostid eq $lonhost);      my @hexstr=('0','1','2','3','4','5','6','7',
     my $hostname = &Apache::lonnet::hostname($hostid);                  '8','9','a','b','c','d','e','f');
     next if ($last eq $hostname);      my $lkey='';
             $spares.='<br /><font size="+1"><a href="http://'.      for (0..7) {
                 $hostname.          $lkey.=$hexstr[rand(15)];
                 '/adm/login?domain='.$authdomain.'">'.      }
                 $hostname.'</a>'.  
                 ' '.&mt('(preferred)').'</font>'.$/;      my $ukey='';
     $last=$hostname;      for (0..7) {
         }          $ukey.=$hexstr[rand(15)];
 $spares.= '<br />';      }
 my %all_hostnames = &Apache::lonnet::all_hostnames();  
 foreach my $hostid (sort      my $lextkey=hex($lkey);
     {      if ($lextkey>2147483647) { $lextkey-=4294967296; }
  &Apache::lonnet::hostname($a) cmp  
     &Apache::lonnet::hostname($b);      my $uextkey=hex($ukey);
     }      if ($uextkey>2147483647) { $uextkey-=4294967296; }
     keys(%all_hostnames)) {  
     next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});  # -------------------------------------------------------- Store away log token
     my $hostname = &Apache::lonnet::hostname($hostid);      my $tokenextras;
     next if ($last eq $hostname);      if ($env{'form.role'}) {
     $spares.='<br /><a href="http://'.          $tokenextras = '&role='.&escape($env{'form.role'});
  $hostname.      }
  '/adm/login?domain='.$authdomain.'">'.      if ($env{'form.symb'}) {
  $hostname.'</a>';          if (!$tokenextras) {
     $last=$hostname;              $tokenextras = '&';
 }          }
 $r->print(          $tokenextras .= '&symb='.&escape($env{'form.symb'});
    '<html>'      }
   .'<head><title>'      if ($env{'form.iptoken'}) {
   .&mt('The LearningOnline Network with CAPA')          if (!$tokenextras) {
   .'</title></head>'              $tokenextras = '&&';
   .'<body bgcolor="#FFFFFF">'          }
   .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'          $tokenextras .= '&iptoken='.&escape($env{'form.iptoken'});
   .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'      }
   .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>'      my $logtoken=Apache::lonnet::reply(
   .'<p>'.&mt('Please attempt to login to one of the following servers:').'</p>'         'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
   .$spares         $lonhost);
   .'</body>'  
   .'</html>'  # -- If we cannot talk to ourselves, or hostID does not map to a hostname
 );  #    we are in serious trouble
 return OK;  
 }      if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {
           if ($logtoken eq 'no_such_host') {
 # ----------------------------------------------- Apparently we are in business              &Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab');
 $servadm=~s/\,/\<br \/\>/g;          }
           my $spares='';
 # ----------------------------------------------------------- Front page design   my $last;
 my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);          foreach my $hostid (sort
 my $font=&Apache::loncommon::designparm('login.font',$domain);      {
 my $link=&Apache::loncommon::designparm('login.link',$domain);   &Apache::lonnet::hostname($a) cmp
 my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);      &Apache::lonnet::hostname($b);
 my $alink=&Apache::loncommon::designparm('login.alink',$domain);      }
 my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);      keys(%Apache::lonnet::spareid)) {
 my $logo=&Apache::loncommon::designparm('login.logo',$domain);              next if ($hostid eq $lonhost);
 my $img=&Apache::loncommon::designparm('login.img',$domain);      my $hostname = &Apache::lonnet::hostname($hostid);
 my $domainlogo='<div>'.&Apache::loncommon::domainlogo($domain).'</div>';      next if (($last eq $hostname) || ($hostname eq ''));
 my $login=&Apache::loncommon::designparm('login.login',$domain);              $spares.='<br /><font size="+1"><a href="http://'.
 if ($login eq '') {                  $hostname.
 $login = $iconpath.'/'.&mt('userauthentication.gif');                  '/adm/login?domain='.$authdomain.'">'.
 }                  $hostname.'</a>'.
 my $showbanner = 1;                  ' '.&mt('(preferred)').'</font>'.$/;
 my $showmainlogo = 1;      $last=$hostname;
 if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {          }
     $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);          if ($spares) {
 }              $spares.= '<br />';
 if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {          }
     $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);          my %all_hostnames = &Apache::lonnet::all_hostnames();
 }          foreach my $hostid (sort
 my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);      {
 my $showcoursecat =   &Apache::lonnet::hostname($a) cmp
 &Apache::loncommon::designparm('login.coursecatalog',$domain);      &Apache::lonnet::hostname($b);
 my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);      }
 my $shownewuserlink =       keys(%all_hostnames)) {
 &Apache::loncommon::designparm('login.newuser',$domain);              next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
 my $now=time;              my $hostname = &Apache::lonnet::hostname($hostid);
 my $js = (<<ENDSCRIPT);              next if (($last eq $hostname) || ($hostname eq ''));
               $spares.='<br /><a href="http://'.
 <script type="text/javascript" language="JavaScript">               $hostname.
 // <![CDATA[               '/adm/login?domain='.$authdomain.'">'.
 function send()               $hostname.'</a>';
 {              $last=$hostname;
 this.document.server.elements.uname.value           }
 =this.document.client.elements.uname.value;           $r->print(
      '<html>'
 this.document.server.elements.udom.value    .'<head><title>'
 =this.document.client.elements.udom.value;    .&mt('The LearningOnline Network with CAPA')
     .'</title></head>'
 uextkey=this.document.client.elements.uextkey.value;    .'<body bgcolor="#FFFFFF">'
 lextkey=this.document.client.elements.lextkey.value;    .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
 initkeys();    .'<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.elements.upass0.value          if ($spares) {
     =crypted(this.document.client.elements.upass$now.value.substr(0,15));              $r->print('<p>'.&mt('Please attempt to login to one of the following servers:')
 this.document.server.elements.upass1.value                       .'</p>'
     =crypted(this.document.client.elements.upass$now.value.substr(15,15));                       .$spares);
 this.document.server.elements.upass2.value          }
     =crypted(this.document.client.elements.upass$now.value.substr(30,15));          $r->print('</body>'
                    .'</html>'
 this.document.client.elements.uname.value='';          );
 this.document.client.elements.upass$now.value='';          return OK;
       }
 this.document.server.submit();  
 return false;  # ----------------------------------------------- Apparently we are in business
 }      $servadm=~s/\,/\<br \/\>/g;
 // ]]>  
 </script>  # ----------------------------------------------------------- Front page design
       my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);
 ENDSCRIPT      my $font=&Apache::loncommon::designparm('login.font',$domain);
       my $link=&Apache::loncommon::designparm('login.link',$domain);
 # --------------------------------------------------- Print login screen header      my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);
       my $alink=&Apache::loncommon::designparm('login.alink',$domain);
 my %add_entries = (      my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);
        bgcolor      => "$mainbg",      my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain);
        text         => "$font",      my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain);
        link         => "$link",      my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain);
        vlink        => "$vlink",      my $logo=&Apache::loncommon::designparm('login.logo',$domain);
        alink        => "$alink",);      my $img=&Apache::loncommon::designparm('login.img',$domain);
       my $domainlogo=&Apache::loncommon::domainlogo($domain);
 $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,      my $showbanner = 1;
        { 'redirect'       => [$expire,'/adm/roles'],       my $showmainlogo = 1;
  'add_entries' => \%add_entries,      if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
  'only_body'   => 1,}));          $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
       }
 # ----------------------------------------------------------------------- Texts      if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
           $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
 my %lt=&Apache::lonlocal::texthash(      }
           'un'       => 'Username',      my $showadminmail;
           'pw'       => 'Password',      my @possdoms = &Apache::lonnet::current_machine_domains();
           'dom'      => 'Domain',      if (grep(/^\Q$domain\E$/,@possdoms)) {
           'perc'     => 'percent',          $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
           'load'     => 'Server Load',      }
           'userload' => 'User Load',      my $showcoursecat =
           'catalog'  => 'Course/Community Catalog',          &Apache::loncommon::designparm('login.coursecatalog',$domain);
           'log'      => 'Log in',      my $shownewuserlink =
           'help'     => 'Log-in Help',          &Apache::loncommon::designparm('login.newuser',$domain);
           'serv'     => 'Server',      my $showhelpdesk =
           'servadm'  => 'Server Administration',          &Apache::loncommon::designparm('login.helpdesk',$domain);
           'helpdesk' => 'Contact Helpdesk',      my $now=time;
           'forgotpw' => 'Forgot password?',      my $js = (<<ENDSCRIPT);
           'newuser'  => 'New User?',  
        );  <script type="text/javascript" language="JavaScript">
 # -------------------------------------------------- Change password field name  // <![CDATA[
   function send()
 my $forgotpw = &forgotpwdisplay(%lt);  {
 $forgotpw .= '<br />' if $forgotpw;  this.document.server.elements.uname.value
 my $loginhelp = &loginhelpdisplay($authdomain,%lt);  =this.document.client.elements.uname.value;
 $loginhelp .= '<br />' if $loginhelp;  
   this.document.server.elements.udom.value
 # ---------------------------------------------------- Serve out DES JavaScript  =this.document.client.elements.udom.value;
 {  
 my $jsh=Apache::File->new($include."/londes.js");  uextkey=this.document.client.elements.uextkey.value;
 $r->print(<$jsh>);  lextkey=this.document.client.elements.lextkey.value;
 }  initkeys();
 # ---------------------------------------------------------- Serve rest of page  
   if(this.document.server.action.substr(0,5) === 'http:'){
 $r->print(      this.document.server.elements.upass0.value
   '<div class="LC_loginpage_container">');          =getCrypted(this.document.client.elements.upass$now.value);
   } else {
 #      this.document.server.elements.upass0.value
 #  If the loadbalancing yielded just http:// because perhaps there's no loadbalancing?          =this.document.client.elements.upass$now.value;
 #  then just us a relative link to authenticate:  }
 #  
   this.document.client.elements.uname.value='';
 $r->print(<<ENDSERVERFORM);  this.document.client.elements.upass$now.value='';
 <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">  
    <input type="hidden" name="logtoken" value="$logtoken" />  this.document.server.submit();
    <input type="hidden" name="serverid" value="$lonhost" />  return false;
    <input type="hidden" name="uname" value="" />  }
    <input type="hidden" name="upass0" value="" />  
    <input type="hidden" name="upass1" value="" />  function enableInput() {
    <input type="hidden" name="upass2" value="" />      this.document.client.elements.upass$now.removeAttribute("readOnly");
    <input type="hidden" name="udom" value="" />      this.document.client.elements.uname.removeAttribute("readOnly");
    <input type="hidden" name="localpath" value="$env{'form.localpath'}" />      this.document.client.elements.udom.removeAttribute("readOnly");
    <input type="hidden" name="localres" value="$env{'form.localres'}" />      return;
   </form>  }
 ENDSERVERFORM  
 my $coursecatalog;  // ]]>
 if (($showcoursecat eq '') || ($showcoursecat)) {  </script>
     $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';  
 }  ENDSCRIPT
 my $newuserlink;  
 if ($shownewuserlink) {  # --------------------------------------------------- Print login screen header
     $newuserlink = &newuser_link($lt{'newuser'}).'<br />';  
 }      my %add_entries = (
 my $logintitle;         bgcolor      => "$mainbg",
 if ($loginheader eq 'text') {         text         => "$font",
     $logintitle ='<h2>'.$lt{'log'}.'</h2>';         link         => "$link",
 } else {         vlink        => "$vlink",
     $logintitle = '<img src="'.$login.'" alt="'.         alink        => "$alink",
                   &mt('User Authentication').'" />';                 onload       => 'javascript:enableInput();',);
 }  
       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" /><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" /><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" /><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 class="LC_loginpage_space">&nbsp;</div>          }
 <div class="LC_loginpage_floatLeft">      }
 <div class="LC_loginpage_loginContainer">  
   $logintitle      $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
    <table border="0" align="left" cellspacing="1" cellpadding="2" width="100%">         { 'redirect'       => [$expire,'/adm/roles'],
       <tr>   'add_entries' => \%add_entries,
    <td>   'only_body'   => 1,}));
  $loginform  
            </td>  # ----------------------------------------------------------------------- Texts
       </tr>  
    </table>        my %lt=&Apache::lonlocal::texthash(
    $noscript_warning            'un'       => 'Username',
 </div>            'pw'       => 'Password',
               'dom'      => 'Domain',
 <div class="LC_loginpage_loginInfo">            'perc'     => 'percent',
   $loginhelp            'load'     => 'Server Load',
   $forgotpw            'userload' => 'User Load',
   $contactblock            'catalog'  => 'Course/Community Catalog',
   $newuserlink            'log'      => 'Log in',
   $coursecatalog            'help'     => 'Log-in Help',
 </div>            'serv'     => 'Server',
 </div>            'servadm'  => 'Server Administration',
 ENDTOP            'helpdesk' => 'Contact Helpdesk',
     if ($showmainlogo) {            'forgotpw' => 'Forgot password?',
         $r->print(' <img src="'.$logo.'" alt="" />'."\n");            'newuser'  => 'New User?',
     }         );
 $r->print(<<ENDTOP);  # -------------------------------------------------- Change password field name
 $announcements  
 $domainlogo      my $forgotpw = &forgotpwdisplay(%lt);
 <div class="LC_loginpage_space">&nbsp;</div>      $forgotpw .= '<br />' if $forgotpw;
 ENDTOP      my $loginhelp = &Apache::lonauth::loginhelpdisplay($authdomain);
       if ($loginhelp) {
 $r->print(<<ENDDOCUMENT);          $loginhelp = '<a href="'.$loginhelp.'">'.$lt{'help'}.'</a><br />';
      <table border="0" cellspacing="0" cellpadding="0">      }
       <tr>  
        <td  align="left" valign="top">  # ---------------------------------------------------- Serve out DES JavaScript
         <small><b>$lt{'dom'}:&nbsp;</b></small>      {
        </td>      my $jsh=Apache::File->new($include."/londes.js");
        <td  align="left" valign="top">      $r->print(<$jsh>);
         <small><tt>&nbsp;$domain</tt></small>      }
        </td>  # ---------------------------------------------------------- Serve rest of page
       </tr>  
       <tr>      $r->print(
        <td  align="left" valign="top">      '<div class="LC_Box"'
         <small><b>$lt{'serv'}:&nbsp;</b></small>     .' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'
        </td>  );
        <td align="left" valign="top">  
         <small><tt>&nbsp;$lonhost ($role)</tt></small>      $r->print(<<ENDSERVERFORM);
        </td>  <form name="server" action="/adm/authenticate" method="post" target="_top">
       </tr>     <input type="hidden" name="logtoken" value="$logtoken" />
       <tr>     <input type="hidden" name="serverid" value="$lonhost" />
        <td align="left" valign="top">     <input type="hidden" name="uname" value="" />
         <small><b>$lt{'load'}:&nbsp;</b></small>     <input type="hidden" name="upass0" value="" />
        </td>     <input type="hidden" name="udom" value="" />
        <td align="left" valign="top">     <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>     <input type="hidden" name="localres" value="$env{'form.localres'}" />
        </td>    </form>
       </tr>  ENDSERVERFORM
       <tr>      my $coursecatalog;
        <td align="left" valign="top">      if (($showcoursecat eq '') || ($showcoursecat)) {
         <small><b>$lt{'userload'}:&nbsp;</b></small>          $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';
        </td>      }
        <td align="left" valign="top">      my $newuserlink;
         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>      if ($shownewuserlink) {
        </td>          $newuserlink = &newuser_link($lt{'newuser'}).'<br />';
       </tr>      }
       <tr>      my $logintitle =
        <td colspan="2" align="left">          '<h2 class="LC_hcell"'
         <small>$version</small>         .' style="background:'.$loginbox_header_bgcol.';'
        </td>         .' color:'.$loginbox_header_textcol.'">'
       </tr>         .$lt{'log'}
      </table>         .'</h2>';
  </div>  
       my $noscript_warning='<noscript><span class="LC_warning"><b>'
 <script type="text/javascript">                          .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
 // <![CDATA[                          .'</b></span></noscript>';
 // the if prevents the script error if the browser can not handle this      my $helpdeskscript;
 if ( document.client.uname ) { document.client.uname.focus(); }      my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
 // ]]>                                         $authdomain,\$helpdeskscript,
 </script>                                         $showhelpdesk,\@possdoms);
 $helpdeskscript  
       my $mobileargs;
 ENDDOCUMENT      if ($clientmobile) {
     my %endargs = ( 'noredirectlink' => 1, );          $mobileargs = 'autocapitalize="off" autocorrect="off"';
     $r->print(&Apache::loncommon::end_page(\%endargs));      }
     return OK;      my $loginform=(<<LFORM);
 }  <form name="client" action="" onsubmit="return(send())">
     <input type="hidden" name="lextkey" value="$lextkey" />
 sub check_loginvia {    <input type="hidden" name="uextkey" value="$uextkey" />
     my ($domain,$lonhost) = @_;    <b><label for="uname">$lt{'un'}</label>:</b><br />
     if ($domain eq '' || $lonhost eq '') {    <input type="text" name="uname" id="uname" size="15" value="$authusername" readonly="readonly" $mobileargs /><br />
         return;    <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
     }    <input type="password" name="upass$now" id="upass$now" size="15" readonly="readonly" /><br />
     my %domconfhash = &Apache::loncommon::get_domainconf($domain);    <b><label for="udom">$lt{'dom'}</label>:</b><br />
     my $loginvia = $domconfhash{$domain.'.login.loginvia_'.$lonhost};    <input type="text" name="udom" id="udom" size="15" value="$authdomain" readonly="readonly" $mobileargs /><br />
     my $loginvia_exempt = $domconfhash{$domain.'.login.loginvia_exempt_'.$lonhost};    <input type="submit" value="$lt{'log'}" />
     my $output;  </form>
     if ($loginvia ne '') {  LFORM
         my $noredirect;  
         my $ip = $ENV{'REMOTE_ADDR'};      if ($showbanner) {
         if ($ip eq '127.0.0.1') {          $r->print(<<HEADER);
             $noredirect = 1;  <!-- The LON-CAPA Header -->
         } else {  <div style="background:$pgbg;margin:0;width:100%;">
             if ($loginvia_exempt ne '') {    <img src="$img" border="0" alt="The Learning Online Network with CAPA" class="LC_maxwidth" />
                 my @exempt = split(',',$loginvia_exempt);  </div>
                 if (grep(/^\Q$ip\E$/,@exempt)) {  HEADER
                     $noredirect = 1;      }
                 }      $r->print(<<ENDTOP);
             }  <div style="float:left;margin-top:0;">
         }  <div class="LC_Box" style="background:$loginbox_bg;">
         unless ($noredirect) {    $logintitle
             my ($newhost,$path);    $loginform
             if ($loginvia =~ /:/) {    $noscript_warning
                 ($newhost,$path) = split(':',$loginvia);  </div>
             } else {   
                 $newhost = $loginvia;  <div class="LC_Box" style="padding-top: 10px;">
             }    $loginhelp
             if ($newhost ne $lonhost) {    $forgotpw
                 if (&Apache::lonnet::hostname($newhost) ne '') {    $contactblock
                     $output = &redirect_page($newhost,$path);    $newuserlink
                 }    $coursecatalog
             }  </div>
         }  </div>
     }  
     return $output;  <div>
 }  ENDTOP
       if ($showmainlogo) {
 sub redirect_page {          $r->print(' <img src="'.$logo.'" alt="" class="LC_maxwidth" />'."\n");
     my ($desthost,$path) = @_;      }
     my $protocol = $Apache::lonnet::protocol{$desthost};  $r->print(<<ENDTOP);
     $protocol = 'http' if ($protocol ne 'https');  $announcements
     unless ($path =~ m{^/}) {  </div>
         $path = '/'.$path;  <hr style="clear:both;" />
     }  ENDTOP
     my $url = $protocol.'://'.&Apache::lonnet::hostname($desthost).$path;      my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow);
     if ($env{'form.firsturl'} ne '') {      $domainrow = <<"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{'dom'}:&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;$domain</tt></small>
 }         </td>
         </tr>
 sub contactdisplay {  END
     my ($lt,$servadm,$showadminmail,$authdomain,$helpdeskscript) = @_;      $serverrow = <<"END";
     my $contactblock;        <tr>
     my $showhelpdesk = 0;         <td  align="left" valign="top">
     my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};          <small><b>$lt{'serv'}:&nbsp;</b></small>
     if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {         </td>
         $showhelpdesk = 1;         <td align="left" valign="top">
     }          <small><tt>&nbsp;$lonhost ($role)</tt></small>
     if ($servadm && $showadminmail) {         </td>
         $contactblock .= $$lt{'servadm'}.':<br />'.        </tr>
                          '<tt>'.$servadm.'</tt><br />';  END
     }      if ($loadlim) {
     if ($showhelpdesk) {          $loadrow = <<"END";
         $contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';        <tr>
         my $thisurl = &escape('/adm/login');         <td align="left" valign="top">
         $$helpdeskscript = <<"ENDSCRIPT";          <small><b>$lt{'load'}:&nbsp;</b></small>
 <script type="text/javascript">         </td>
 // <![CDATA[         <td align="left" valign="top">
 function helpdesk() {          <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>
     var codedom = document.client.udom.value;         </td>
     if (codedom == '') {        </tr>
         codedom = "$authdomain";  END
     }      }
     var querystr = "origurl=$thisurl&codedom="+codedom;      if ($uloadlim) {
     document.location.href = "/adm/helpdesk?"+querystr;          $userloadrow = <<"END";
     return;        <tr>
 }         <td align="left" valign="top">
 // ]]>          <small><b>$lt{'userload'}:&nbsp;</b></small>
 </script>         </td>
 ENDSCRIPT         <td align="left" valign="top">
     }          <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>
     return $contactblock;         </td>
 }        </tr>
   END
 sub forgotpwdisplay {      }
     my (%lt) = @_;      if (($version ne '') && ($version ne '<!-- VERSION -->')) {
     my $prompt_for_resetpw = 1;           $versionrow = <<"END";
     if ($prompt_for_resetpw) {        <tr>
         return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';         <td colspan="2" align="left">
     }          <small>$version</small>
     return;         </td>
 }        </tr>
   END
 sub loginhelpdisplay {      }
     my ($authdomain,%lt) = @_;  
     my $login_help = 1;      $r->print(<<ENDDOCUMENT);
     if ($login_help) {      <div style="float: left;">
         my $dom = $authdomain;       <table border="0" cellspacing="0" cellpadding="0">
         if ($dom eq '') {  $domainrow
             $dom = &Apache::lonnet::default_login_domain();  $serverrow
         }  $loadrow    
         my %helpconfig = &Apache::lonnet::get_dom('configuration',['helpsettings'],$dom);  $userloadrow
         my $loginhelp_url = $helpconfig{'helpsettings'}{'loginhelpurl'};  $versionrow
         if ($loginhelp_url ne '') {       </table>
             return '<a href="'.$loginhelp_url.'">'.$lt{'help'}.'</a>';      </div>
         } else {      <div style="float: right;">
             return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';      $domainlogo
         }      </div>
     }      <br style="clear:both;" />
     return;   </div>
 }  
   <script type="text/javascript">
 sub coursecatalog_link {  // <![CDATA[
     my ($linkname) = @_;  // the if prevents the script error if the browser can not handle this
     return <<"END";  if ( document.client.uname ) { document.client.uname.focus(); }
       <span class="LC_nobreak"><a href="/adm/coursecatalog">$linkname</a></span>  // ]]>
 END  </script>
 }  $helpdeskscript
   
 sub newuser_link {  ENDDOCUMENT
     my ($linkname) = @_;      my %endargs = ( 'noredirectlink' => 1, );
     return '<a href="/adm/createaccount">'.$linkname.'</a>';      $r->print(&Apache::loncommon::end_page(\%endargs));
 }      return OK;
   }
 1;  
 __END__  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.135  
changed lines
  Added in v.1.170


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