File:  [LON-CAPA] / loncom / auth / lonlogin.pm
Revision 1.14: download - view: text, annotated - select for diffs
Wed Mar 13 19:32:55 2002 UTC (22 years, 2 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- Josh Brunskole's new login page.

    1: # The LearningOnline Network
    2: # Login Screen
    3: #
    4: # $Id: lonlogin.pm,v 1.14 2002/03/13 19:32:55 albertel Exp $
    5: #
    6: # Copyright Michigan State University Board of Trustees
    7: #
    8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: #
   10: # LON-CAPA is free software; you can redistribute it and/or modify
   11: # it under the terms of the GNU General Public License as published by
   12: # the Free Software Foundation; either version 2 of the License, or
   13: # (at your option) any later version.
   14: #
   15: # LON-CAPA is distributed in the hope that it will be useful,
   16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: # GNU General Public License for more details.
   19: #
   20: # You should have received a copy of the GNU General Public License
   21: # along with LON-CAPA; if not, write to the Free Software
   22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23: #
   24: # /home/httpd/html/adm/gpl.txt
   25: #
   26: # http://www.lon-capa.org/
   27: #
   28: # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
   29: # 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9,
   30: # 1/17/01 Gerd Kortemeyer
   31: #
   32: # 2/7/02,2/8,2/12,2/14,2/15,2/19 Josh Brunskole
   33: 
   34: package Apache::lonlogin;
   35: 
   36: use strict;
   37: use Apache::Constants qw(:common);
   38: use Apache::File ();
   39: use Apache::lonnet();
   40: use Apache::loncommon();
   41: 
   42: sub handler {
   43:     my $r = shift;
   44:     $r->content_type('text/html');
   45:     &Apache::loncommon::no_cache($r);
   46:     $r->send_http_header;
   47:     return OK if $r->header_only;
   48: 
   49:     my $iconpath= $r->dir_config('lonIconsURL');
   50:     my $domain  = $r->dir_config('lonDefDomain');
   51:     my $role    = $r->dir_config('lonRole');
   52:     my $loadlim = $r->dir_config('lonLoadLim');
   53:     my $servadm = $r->dir_config('lonAdmEMail');
   54:     my $sysadm  = $r->dir_config('lonSysEMail');
   55:     my $lonhost = $r->dir_config('lonHostID');
   56:     my $tabdir  = $r->dir_config('lonTabDir');
   57:     my $include = $r->dir_config('lonIncludes');
   58: 
   59:     my $loadavg;
   60:    {
   61:        my $loadfile=Apache::File->new('/proc/loadavg');
   62:        $loadavg=<$loadfile>;
   63:    }
   64:     $loadavg =~ s/\s.*//g;
   65:     my $loadpercent=100*$loadavg/$loadlim;
   66: 
   67:     my $otherserver='http://'.$ENV{'SERVER_NAME'};
   68:     my $firsturl=$ENV{'request.firsturl'};
   69: # ---------------------------------------- Are we access server and overloaded?
   70:     if (($role eq 'access') && ($loadpercent>100.0)) {
   71:         $otherserver=Apache::lonnet::spareserver();
   72:     }
   73: 
   74: # -------------------------------------------------------- Set login parameters
   75: 
   76:     my @hexstr=('0','1','2','3','4','5','6','7',
   77:                 '8','9','a','b','c','d','e','f');
   78:     my $lkey='';
   79:     for (0..7) {
   80:         $lkey.=$hexstr[rand(15)];
   81:     }
   82: 
   83:     my $ukey='';
   84:     for (0..7) {
   85:         $ukey.=$hexstr[rand(15)];
   86:     }
   87: 
   88:     my $lextkey=hex($lkey);
   89:     my $uextkey=hex($ukey);
   90:     my $logtoken=Apache::lonnet::reply(
   91:        'tmpput:'.$ukey.$lkey.'&'.$firsturl,
   92:        $lonhost);
   93: 
   94: # --------------------------------------------------- Print login screen header
   95:     $r->print(<<ENDHEADER);
   96: <html>
   97: <head>
   98: <title>The LearningOnline Network with CAPA Login</title>
   99: </head>
  100: ENDHEADER
  101: # ---------------------------------------------------- Serve out DES JavaScript
  102:     {
  103: 	my $jsh=Apache::File->new($include."/londes.js");
  104:         $r->print(<$jsh>);
  105:     }
  106: # ---------------------------------------------------------- Serve rest of page
  107:     $r->print(<<ENDDOCUMENT);
  108: 
  109: <body bgcolor="#006600" text="#000000" link="#999999" vlink="#999999"
  110:  onLoad="init();" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
  111: 
  112:  <script language="JavaScript">
  113:     function send()
  114:     {
  115: 	this.document.server.elements.uname.value
  116:        =this.document.client.elements.uname.value;
  117: 
  118:         this.document.server.elements.udom.value
  119:        =this.document.client.elements.udom.value;
  120: 
  121:         uextkey=this.document.client.elements.uextkey.value;
  122:         lextkey=this.document.client.elements.lextkey.value;
  123:         initkeys();
  124: 
  125:         this.document.server.elements.upass.value
  126: 	    =crypted(this.document.client.elements.upass.value);
  127: 
  128:         this.document.server.submit();
  129:     }
  130:  </script>
  131: 
  132:  <!-- The Main Table -->
  133:  <table width="100%" cellpadding=0 cellspacing=0 border=0>
  134: 
  135:   <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
  136:    <input type=hidden name=logtoken value="$logtoken">
  137:    <input type=hidden name=serverid value="$lonhost">
  138:    <input type=hidden name=uname value="">
  139:    <input type=hidden name=upass value="">
  140:    <input type=hidden name=udom value="">
  141:   </form>
  142: 
  143:   <!-- The LON-CAPA Header -->
  144:   <tr>
  145: 
  146:    <!-- Row 1 Columns 2-4 -->
  147:    <td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="#006600"><img src="$iconpath/header.gif" border=0 /></td>
  148:   </tr>
  149: 
  150:   <!-- The gray bar that starts the two table frames -->
  151:   <tr>
  152: 
  153:    <!-- Row 2 Column 1 -->
  154:    <td width=182 height=27 bgcolor="#cccccc">&nbsp;</td>
  155: 
  156:    <!-- Row 2 Column 2 -->
  157:    <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 /></td>
  158: 
  159:    <!-- Row 2 Column 3 -->
  160:    <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" /></td>
  161: 
  162:    <!-- Row 2 Column 4 -->
  163:    <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 /></td>
  164:   </tr>
  165:   <tr>
  166:    
  167:    <!-- A cell that will hold the 'access' and 'about' buttons -->
  168:    <!-- Row 3 Column 1 -->
  169:    <td valign="top" height=60 align="center" bgcolor="#cccccc">
  170:     <a href="/adm/accessibility.html"><img src="$iconpath/accessbutton.gif" border=0 /></a>
  171:     <br />
  172:     <a href="/adm/about.html"><img src="$iconpath/aboutlon.gif" border=0 /></a>
  173:    </td>
  174: 
  175:    <!-- The shaded space between the two main columns -->
  176:    <!-- Row 3 Column 2 -->
  177:    <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" /></td>
  178: 
  179:    <!-- The right main column holding the large LON-CAPA logo-->
  180:    <!-- Rows 3-4 Column 3 -->
  181:    <td align="center" valign="top" width="100%" height="100%" rowspan=2 bgcolor="#ffffff">
  182:     <center>
  183:      <img src="$iconpath/loncapalogo.gif" />
  184:     </center>
  185:    </td>
  186: 
  187:    <!-- Row 3 Column 4 -->
  188:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" /></td>
  189:   </tr>
  190:   <tr>
  191: 
  192:    <!-- The entry form -->
  193:    <!-- Row 4 Column 1 -->
  194:    <td align="center" valign="middle" bgcolor="#cccccc">
  195:     <form name="client">
  196:      <input type="hidden" name="lextkey" value="$lextkey">
  197:      <input type="hidden" name="uextkey" value="$uextkey">
  198: 
  199:      <!-- Start the sub-table for text and input alignment -->
  200:      <table border=0 cellspacing=0 cellpadding=0>
  201:       <tr><td bgcolor="#cccccc" colspan=2><img src="$iconpath/userauthentication.gif" /></td></tr>
  202:       <tr>
  203:        <td bgcolor="#ffffff"><br /><font size=-1><b>&nbsp;&nbsp;&nbsp;User Name:</b></font></td>
  204:        <td bgcolor="#ffffff"><br /><input type="text" name="uname" size="10" /></td>
  205:       </tr>
  206:       <tr>
  207:        <td bgcolor="#ffffff"><font size=-1><b>&nbsp;&nbsp;&nbsp;Password:</b></font></td>
  208:        <td bgcolor="#ffffff"><input type="password" name="upass" size="10" /></td>
  209:       </tr>
  210:       <tr>
  211:        <td bgcolor="#ffffff"><font size=-1><b>&nbsp;&nbsp;&nbsp;Domain:</b></font></td>
  212:        <td bgcolor="#ffffff"><input type="text" name="udom" size="10" value=$domain /></td>
  213:       </tr>
  214:       <tr>
  215:        <td bgcolor="#ffffff" valign="bottom" align="center" colspan=2>
  216:         <br />
  217:         <input type="button" value="Log In" onClick="send();" />
  218:        </td>
  219:       </tr>
  220:      </table>
  221:      <!-- End sub-table -->
  222: 
  223:     </form>
  224:    </td>
  225: 
  226:    <!-- Row 4 Column 2 -->
  227:    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" /></td>
  228: 
  229:    <!-- Row 4 Column 4 -->
  230:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" /></td>
  231:   </tr>
  232:   <tr>
  233: 
  234:    <!-- Row 5 Column 1 -->
  235:    <td bgcolor="#cccccc" valign="middle" align="left">
  236:      <br />
  237:      <table border=0 cellspacing=0 cellpadding=0>
  238:       <tr>
  239:        <td bgcolor="#cccccc" align="left" valign="top">
  240:         <small><b>&nbsp;&nbsp;&nbsp;Domain:&nbsp;</b></small>
  241:        </td>
  242:        <td bgcolor="#cccccc" align="left" valign="top">
  243:         <small><tt>&nbsp;$domain</tt></small>
  244:        </td>
  245:       </tr>
  246:       <tr>
  247:        <td bgcolor="#cccccc" align="left" valign="top">
  248:         <small><b>&nbsp;&nbsp;&nbsp;Server:&nbsp;</b></small>
  249:        </td>
  250:        <td bgcolor="#cccccc" align="left" valign="top">
  251:         <small><tt>&nbsp;$lonhost ($role)</tt></small>
  252:        </td>
  253:       </tr>
  254:       <tr>
  255:        <td bgcolor="#cccccc" align="left" valign="top">
  256:         <small><b>&nbsp;&nbsp;&nbsp;Load:&nbsp;</b></small>
  257:        </td>
  258:        <td bgcolor="#cccccc" align="left" valign="top">
  259:         <small><tt>&nbsp;$loadpercent percent</tt></small>
  260:        </td>
  261:       </tr>
  262:      </table>
  263:      <br />
  264:     <small>
  265:      <b>&nbsp;&nbsp;&nbsp;System Administration:</b><br />
  266:      <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sysadm</tt><br />
  267:      <b>&nbsp;&nbsp;&nbsp;Server Administration:</b><br />
  268:      <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$servadm</tt>
  269:     </small>
  270:    </td>
  271: 
  272:    <!-- Row 5 Column 2 -->
  273:    <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" /></td>
  274: 
  275:    <!-- Row 5 Column 3 -->
  276:    <td width="100%" valign="bottom" bgcolor="#ffffff"><img src="$iconpath/litetext.gif" /><img src="$iconpath/lite.gif" /></td>
  277: 
  278:    <!-- Row 5 Column 4 -->
  279:    <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" /></td>
  280:   </tr>
  281:   <tr>
  282: 
  283:    <!-- Row 6 Column 1 -->
  284:    <td bgcolor="#cccccc">&nbsp;</td>
  285: 
  286:    <!-- Row 6 Column 2 -->
  287:    <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" /></td>
  288: 
  289:    <!-- Row 6 Column 3 -->
  290:    <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" /></td>
  291: 
  292:    <!-- Row 6 Column 4 -->
  293:    <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" /></td>
  294:   </tr>
  295:  </table>
  296: </body>
  297: </html>
  298: 
  299: ENDDOCUMENT
  300:     return OK;
  301: } 
  302: 
  303: 1;
  304: __END__

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