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

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


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