Diff for /loncom/auth/lonlogin.pm between versions 1.98 and 1.106.4.5

version 1.98, 2008/01/16 20:42:44 version 1.106.4.5, 2010/02/09 17:49:15
Line 46  sub handler { Line 46  sub handler {
  (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},   (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
       $ENV{'REDIRECT_QUERY_STRING'}),        $ENV{'REDIRECT_QUERY_STRING'}),
  ['interface','username','domain','firsturl','localpath','localres',   ['interface','username','domain','firsturl','localpath','localres',
   'token']);    'token','role','symb']);
       if (!defined($env{'form.firsturl'})) {
           &Apache::lonacc::get_posted_cgi($r,['firsturl']);
       }
   
 # -- check if they are a migrating user  # -- check if they are a migrating user
     if (defined($env{'form.token'})) {      if (defined($env{'form.token'})) {
Line 78  sub handler { Line 81  sub handler {
     &Apache::loncommon::start_page('Already logged in');      &Apache::loncommon::start_page('Already logged in');
  my $end_page =    my $end_page = 
     &Apache::loncommon::end_page();      &Apache::loncommon::end_page();
  $r->print(<<ENDFAILED);          my $dest = '/adm/roles';
 $start_page          if ($env{'form.firsturl'} ne '') {
 <h1>You are already logged in</h1>              $dest = $env{'form.firsturl'};
 <p>Please either <a href="/adm/roles">continue the current session</a> or          }
 <a href="/adm/logout">logout</a>.</p>   $r->print(
 <p>                    $start_page
 <a href="/adm/loginproblems.html">Problems?</a></p>                   .'<h1>'.&mt('You are already logged in!').'</h1>'
 $end_page                   .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
 ENDFAILED                    '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
                    .'<p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'
                    .$end_page
                    );
         return OK;          return OK;
     }      }
   
Line 177  ENDFAILED Line 183  ENDFAILED
     if ($uextkey>2147483647) { $uextkey-=4294967296; }      if ($uextkey>2147483647) { $uextkey-=4294967296; }
   
 # -------------------------------------------------------- Store away log token  # -------------------------------------------------------- Store away log token
       my $tokenextras;
       if ($env{'form.role'}) {
           $tokenextras = '&role='.&escape($env{'form.role'});
       }
       if ($env{'form.symb'}) {
           if (!$tokenextras) {
               $tokenextras = '&';
           }
           $tokenextras .= '&symb='.&escape($env{'form.symb'});
       }
     my $logtoken=Apache::lonnet::reply(      my $logtoken=Apache::lonnet::reply(
        'tmpput:'.$ukey.$lkey.'&'.$firsturl,         'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
        $lonhost);         $lonhost);
   
 # ------------------- If we cannot talk to ourselves, we are in serious trouble  # ------------------- If we cannot talk to ourselves, we are in serious trouble
Line 199  ENDFAILED Line 215  ENDFAILED
                 $hostname.                  $hostname.
                 '/adm/login?domain='.$authdomain.'">'.                  '/adm/login?domain='.$authdomain.'">'.
                 $hostname.'</a>'.                  $hostname.'</a>'.
                 ' (preferred)</font>'.$/;                  ' '.&mt('(preferred)').'</font>'.$/;
     $last=$hostname;      $last=$hostname;
         }          }
         $spares.= '<br />';          $spares.= '<br />';
Line 219  ENDFAILED Line 235  ENDFAILED
                 $hostname.'</a>';                  $hostname.'</a>';
     $last=$hostname;      $last=$hostname;
         }          }
  $r->print(<<ENDTROUBLE);   $r->print(
 <html>             '<html>'
 <head><title>The LearningOnline Network with CAPA</title></head>            .'<head><title>'
 <body bgcolor="#FFFFFF">            .&mt('The LearningOnline Network with CAPA')
 <img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />            .'</title></head>'
 <h3>This LON-CAPA server is temporarily not available for login</h3>            .'<body bgcolor="#FFFFFF">'
 <p>Please attempt to login to one of the following servers:</p>$spares            .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
 </body>            .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
 </html>            .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>'
 ENDTROUBLE            .'<p>'.&mt('Please attempt to login to one of the following servers:').'</p>'
             .$spares
             .'</body>'
             .'</html>'
           );
         return OK;          return OK;
     }      }
   
Line 260  ENDTROUBLE Line 280  ENDTROUBLE
     if ($login eq '') {      if ($login eq '') {
         $login = $iconpath.'/'.&mt('userauthentication.gif');          $login = $iconpath.'/'.&mt('userauthentication.gif');
     }      }
       my $showbanner = 1;
       my $showmainlogo = 1;
       if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
           $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
       }
       if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
           $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
       }
     my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);      my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
     my $showcoursecat =      my $showcoursecat =
         &Apache::loncommon::designparm('login.coursecatalog',$domain);          &Apache::loncommon::designparm('login.coursecatalog',$domain);
     my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);      my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);
       my $shownewuserlink = 
           &Apache::loncommon::designparm('login.newuser',$domain);
     my $now=time;      my $now=time;
     my $js = (<<ENDSCRIPT);      my $js = (<<ENDSCRIPT);
   
  <script language="JavaScript">   <script type="text/javascript">
    // <![CDATA[
     function send()      function send()
     {      {
         this.document.server.elements.uname.value          this.document.server.elements.uname.value
Line 311  ENDTROUBLE Line 342  ENDTROUBLE
         this.document.server.submit();          this.document.server.submit();
         return false;          return false;
     }      }
    // ]]>
  </script>   </script>
   
 ENDSCRIPT  ENDSCRIPT
Line 338  my %lt=&Apache::lonlocal::texthash( Line 370  my %lt=&Apache::lonlocal::texthash(
   'un'  => 'Username',    'un'  => 'Username',
   'pw'  => 'Password',    'pw'  => 'Password',
   'dom' => 'Domain',    'dom' => 'Domain',
   'perc' => 'percent',    'load' => 'Server Load',
   'load' => 'Load',  
                   'userload' => 'User Load',                    'userload' => 'User Load',
                   'about'  => 'About LON-CAPA',                    'about'  => 'About LON-CAPA',
                   'access' => 'Accessibility Options',                    'access' => 'Accessibility Options',
                   'catalog' => 'Course Catalog',                    'catalog' => 'Course/Community Catalog',
   'log' => 'Log in',    'log' => 'Log in',
   'help' => 'Log-in Help',    'help' => 'Log-in Help',
   'serv' => 'Server',    'serv' => 'Server',
                   'servadm' => 'Server Administration',                    'servadm' => 'Server Administration',
                   'helpdesk' => 'Contact Helpdesk',                    'helpdesk' => 'Contact Helpdesk',
                   'forgotpw' => 'Forgot password?');                    'forgotpw' => 'Forgot password?',
                     'newuser'  => 'New User?',
                     'options_headline' => 'Select Accessibility Options',
                     'sprs_img' => 'Suppress rendering of images',
                     'sprs_applet' => 'Suppress Java applets',
                     'sprs_embed' => 'Suppress rendering of embedded multimedia',
                     'sprs_font' => 'Increase font size',
                     'sprs_blackwhite' => 'Switch to black and white mode',
                     'remember' => 'Remember these settings for next login');
 # -------------------------------------------------- Change password field name  # -------------------------------------------------- Change password field name
     my $forgotpw = &forgotpwdisplay(%lt);      my $forgotpw = &forgotpwdisplay(%lt);
     my $loginhelp = &loginhelpdisplay(%lt);      my $loginhelp = &loginhelpdisplay(%lt);
Line 363  my %lt=&Apache::lonlocal::texthash( Line 402  my %lt=&Apache::lonlocal::texthash(
   
     if ($fullgraph) {      if ($fullgraph) {
  $r->print(   $r->print(
   '<table width="100%" cellpadding=0 cellspacing=0 border=0>');    '<table width="100%" cellpadding="0" cellspacing="0" border="0">');
     }      }
   
     $r->print(<<ENDSERVERFORM);      $r->print(<<ENDSERVERFORM);
Line 390  ENDSERVERFORM Line 429  ENDSERVERFORM
     if (($showcoursecat eq '') || ($showcoursecat)) {      if (($showcoursecat eq '') || ($showcoursecat)) {
         $coursecatalog = &coursecatalog_link($lt{'catalog'});          $coursecatalog = &coursecatalog_link($lt{'catalog'});
     }      }
     if ($fullgraph) { $r->print(<<ENDTOP);      my $newuserlink;
       if ($shownewuserlink) {
           $newuserlink = &newuser_link($lt{'newuser'});
       }
       if ($fullgraph) {
           $r->print(<<HEADER);
   <!-- The LON-CAPA Header -->    <!-- The LON-CAPA Header -->
   <tr>    <tr>
   
    <!-- Row 1 Columns 2-4 -->     <!-- Row 1 Columns 2-4 -->
    <td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="$pgbg"><img src="$img" border=0 alt="The Learning Online Network with CAPA" /></td>     <td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="$pgbg">
   HEADER
           if ($showbanner) {
               $r->print(<<ENDBANNER);
   <img src="$img" border="0" alt="The Learning Online Network with CAPA" />
   ENDBANNER
           }
           $r->print(<<ENDSTART);
      </td>
   </tr>    </tr>
   
   <!-- The gray bar that starts the two table frames -->    <!-- The gray bar that starts the two table frames -->
Line 439  ENDSERVERFORM Line 491  ENDSERVERFORM
    <!-- The right main column holding the large LON-CAPA logo-->     <!-- The right main column holding the large LON-CAPA logo-->
    <!-- Rows 3-4 Column 3 -->     <!-- Rows 3-4 Column 3 -->
    <td align="center" valign="top" width="100%" height="100%" bgcolor="$mainbg">     <td align="center" valign="top" width="100%" height="100%" bgcolor="$mainbg">
   ENDSTART
           if ($showmainlogo) {
               $r->print(<<ENDLOGO);
     <center>      <center>
      <img src="$logo" alt="" />       <img src="$logo" alt="" />
     </center>      </center>
   ENDLOGO
           }
           $r->print(<<ENDTOP);
    </td>     </td>
   
    <!-- Row 3 Column 4 -->     <!-- Row 3 Column 4 -->
Line 453  ENDSERVERFORM Line 511  ENDSERVERFORM
    <!-- Row 4 Column 1 -->     <!-- Row 4 Column 1 -->
    <td align="center" valign="middle" bgcolor="$sidebg">     <td align="center" valign="middle" bgcolor="$sidebg">
 ENDTOP  ENDTOP
 } else {      } else {
     $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1><h2>Text-based Interface Login</h2>'.$announcements);          $r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1>'
 }                   .'<h2>'.&mt('Text-based Interface Login').'</h2>'
     $r->print('<form name="client" onsubmit="return(send())">');                   .$announcements);
       }
       $r->print('<form name="client" action="" onsubmit="return(send())">');
     unless ($fullgraph) {      unless ($fullgraph) {
         $r->print(<<ENDACCESSOPTIONS);          $r->print(<<ENDACCESSOPTIONS);
 <h3>Select Accessibility Options</h3>  <h3>$lt{'options_headline'}</h3>
 <label><input type="checkbox" name="imagesuppress" /> Suppress rendering of images</label><br />  <label><input type="checkbox" name="imagesuppress" /> $lt{'sprs_img'}</label><br />
 <label><input type="checkbox" name="appletsuppress" /> Suppress Java applets</label><br />  <label><input type="checkbox" name="appletsuppress" /> $lt{'sprs_applet'}</label><br />
 <label><input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia</label><br />  <label><input type="checkbox" name="embedsuppress" /> $lt{'sprs_embed'}</label><br />
 <label><input type="checkbox" name="fontenhance" /> Increase font size</label><br />  <label><input type="checkbox" name="fontenhance" /> $lt{'sprs_font'}</label><br />
 <label><input type="checkbox" name="blackwhite" /> Switch to black and white mode</label><br />  <label><input type="checkbox" name="blackwhite" /> $lt{'sprs_blackwhite'}</label><br />
 <input type="checkbox" name="remember" /> Remember these settings for next login<hr />  <br />
   <input type="checkbox" name="remember" /> $lt{'remember'}<hr />
 ENDACCESSOPTIONS  ENDACCESSOPTIONS
 } else {      } else {
     $r->print(<<ENDNOOPT);          $r->print(<<ENDNOOPT);
 <input type="hidden" name="imagesuppress"  value="" />  <input type="hidden" name="imagesuppress"  value="" />
 <input type="hidden" name="embedsuppress"  value="" />  <input type="hidden" name="embedsuppress"  value="" />
 <input type="hidden" name="appletsuppress"  value="" />  <input type="hidden" name="appletsuppress"  value="" />
Line 476  ENDACCESSOPTIONS Line 537  ENDACCESSOPTIONS
 <input type="hidden" name="blackwhite"  value="" />  <input type="hidden" name="blackwhite"  value="" />
 <input type="hidden" name="remember"  value="" />  <input type="hidden" name="remember"  value="" />
 ENDNOOPT  ENDNOOPT
 }      }
     my $logintitle;      my $logintitle;
     if ($loginheader eq 'text') {      if ($loginheader eq 'text') {
         $logintitle = '<td bgcolor="'.$bgcol.'" colspan="2">&nbsp;&nbsp;&nbsp;<b><font size="+1" color="'.$textcol.'">'.$lt{'log'}.'</font></b></td>';          $logintitle = '<td bgcolor="'.$bgcol.'" colspan="2">&nbsp;&nbsp;&nbsp;<b><font size="+1" color="'.$textcol.'">'.$lt{'log'}.'</font></b></td>';
Line 484  ENDNOOPT Line 545  ENDNOOPT
         $logintitle = '<td bgcolor="'.$sidebg.'" colspan="2"><img src="'.$login.'" alt="'.          $logintitle = '<td bgcolor="'.$sidebg.'" colspan="2"><img src="'.$login.'" alt="'.
                       &mt('User Authentication').'" /></td>';                        &mt('User Authentication').'" /></td>';
     }      }
       my $noscript_warning='<td colspan="2" bgcolor="'.$mainbg.'">'
                           .'<noscript><div class="LC_warning"><font size="-1">'
                           .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
                           .'</font></div></noscript></td>';
     $r->print(<<ENDLOGIN);      $r->print(<<ENDLOGIN);
      <input type="hidden" name="lextkey" value="$lextkey">       <input type="hidden" name="lextkey" value="$lextkey" />
      <input type="hidden" name="uextkey" value="$uextkey">       <input type="hidden" name="uextkey" value="$uextkey" />
   
      <!-- Start the sub-table for text and input alignment -->       <!-- Start the sub-table for text and input alignment -->
      <table border=0 cellspacing=0 cellpadding=0>       <table border="0" cellspacing="0" cellpadding="0">
       <tr>$logintitle</tr>        <tr>$logintitle</tr>
         <tr>$noscript_warning</tr>
       <tr>        <tr>
        <td bgcolor="$mainbg"><br /><font size=-1><b>&nbsp;&nbsp;&nbsp;<label for="uname">$lt{'un'}</label>:</b></font></td>         <td bgcolor="$mainbg"><br /><font size=-1><b>&nbsp;&nbsp;&nbsp;<label for="uname">$lt{'un'}</label>:</b></font></td>
        <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>         <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>
Line 514  ENDNOOPT Line 580  ENDNOOPT
        <td bgcolor="$mainbg" valign="bottom" align="left" colspan="2">         <td bgcolor="$mainbg" valign="bottom" align="left" colspan="2">
         $loginhelp          $loginhelp
         $forgotpw          $forgotpw
           $newuserlink
           <br />
        </td>         </td>
       </tr>        </tr>
      </table>       </table>
Line 541  ENDLOGIN Line 609  ENDLOGIN
    <!-- Row 5 Column 1 -->     <!-- Row 5 Column 1 -->
    <td bgcolor="$sidebg" valign="middle" align="left">     <td bgcolor="$sidebg" valign="middle" align="left">
      <br />       <br />
      <table border=0 cellspacing=0 cellpadding=0>       <table border="0" cellspacing="0" cellpadding="0">
       <tr>        <tr>
        <td bgcolor="$sidebg" align="left" valign="top">         <td bgcolor="$sidebg" align="left" valign="top">
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>          <small><b>&nbsp;&nbsp;&nbsp;$lt{'dom'}:&nbsp;</b></small>
        </td>         </td>
        <td bgcolor="$sidebg" align="left" valign="top">         <td bgcolor="$sidebg" align="left" valign="middle">
         <small><tt>&nbsp;$domain</tt></small>          <small><tt>&nbsp;$domain</tt></small>
        </td>         </td>
       </tr>        </tr>
Line 554  ENDLOGIN Line 622  ENDLOGIN
        <td bgcolor="$sidebg" align="left" valign="top">         <td bgcolor="$sidebg" align="left" valign="top">
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>          <small><b>&nbsp;&nbsp;&nbsp;$lt{'serv'}:&nbsp;</b></small>
        </td>         </td>
        <td bgcolor="$sidebg" align="left" valign="top">         <td bgcolor="$sidebg" align="left" valign="middle">
         <small><tt>&nbsp;$lonhost ($role)</tt></small>          <small><tt>&nbsp;$lonhost ($role)</tt></small>
        </td>         </td>
       </tr>        </tr>
       <tr>        <tr>
        <td bgcolor="$sidebg" align="left" valign="top">         <td bgcolor="$sidebg" align="left" valign="top"><span class="LC_nobreak">
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small>          <small><b>&nbsp;&nbsp;&nbsp;$lt{'load'}:&nbsp;</b></small></span>
        </td>         </td>
        <td bgcolor="$sidebg" align="left" valign="top">         <td bgcolor="$sidebg" align="left" valign="middle">
         <small><tt>&nbsp;$loadpercent $lt{'perc'}</tt></small>          <small><tt>&nbsp;$loadpercent%</tt></small>
        </td>         </td>
       </tr>        </tr>
       <tr>        <tr>
        <td bgcolor="$sidebg" align="left" valign="top">         <td bgcolor="$sidebg" align="left" valign="top"><span class="LC_nobreak">
         <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small>          <small><b>&nbsp;&nbsp;&nbsp;$lt{'userload'}:&nbsp;</b></small></span>
        </td>         </td>
        <td bgcolor="$sidebg" align="left" valign="top">         <td bgcolor="$sidebg" align="left" valign="middle">
         <small><tt>&nbsp;$userloadpercent $lt{'perc'}</tt></small>          <small><tt>&nbsp;$userloadpercent%</tt></small>
        </td>         </td>
       </tr>        </tr>
      </table>       </table>
Line 607  $domainlogo Line 675  $domainlogo
  </table>   </table>
   
 <script type="text/javascript">  <script type="text/javascript">
   // <![CDATA[
 // the if prevents the script error if the browser can not handle this  // the if prevents the script error if the browser can not handle this
 if ( document.client.uname ) { document.client.uname.focus(); }  if ( document.client.uname ) { document.client.uname.focus(); }
   // ]]>
 </script>  </script>
 $helpdeskscript  $helpdeskscript
   
Line 636  sub contactdisplay { Line 706  sub contactdisplay {
         my $thisurl = &escape('/adm/login');          my $thisurl = &escape('/adm/login');
         $$helpdeskscript = <<"ENDSCRIPT";          $$helpdeskscript = <<"ENDSCRIPT";
 <script type="text/javascript">  <script type="text/javascript">
   // <![CDATA[
 function helpdesk() {  function helpdesk() {
     var codedom = document.client.udom.value;      var codedom = document.client.udom.value;
     if (codedom == '') {      if (codedom == '') {
Line 645  function helpdesk() { Line 716  function helpdesk() {
     document.location.href = "/adm/helpdesk?"+querystr;      document.location.href = "/adm/helpdesk?"+querystr;
     return;      return;
 }  }
   // ]]>
 </script>  </script>
 ENDSCRIPT  ENDSCRIPT
     }      }
Line 658  sub forgotpwdisplay { Line 730  sub forgotpwdisplay {
     my (%lt) = @_;      my (%lt) = @_;
     my $prompt_for_resetpw = 1;       my $prompt_for_resetpw = 1; 
     if ($prompt_for_resetpw) {      if ($prompt_for_resetpw) {
         return '<br />&nbsp;&nbsp;&nbsp;<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a></b><br /><br />';          return '<br />&nbsp;&nbsp;&nbsp;<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a></b><br />';
     }      }
     return;      return;
 }  }
Line 682  sub coursecatalog_link { Line 754  sub coursecatalog_link {
 END  END
 }  }
   
   sub newuser_link {
       my ($linkname) = @_;
       return '&nbsp;&nbsp;&nbsp;<a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';
   }
   
 1;  1;
 __END__  __END__

Removed from v.1.98  
changed lines
  Added in v.1.106.4.5


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