Annotation of loncom/auth/lonlogin.pm, revision 1.11

1.1       albertel    1: # The LearningOnline Network
                      2: # Login Screen
1.11    ! www         3: #
        !             4: # $Id: gplheader.pl,v 1.1 2001/11/29 18:19:27 www 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: #
1.2       www        28: # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
1.10      www        29: # 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9,
                     30: # 1/17/01 Gerd Kortemeyer
1.1       albertel   31: #
                     32: package Apache::lonlogin;
                     33: 
                     34: use strict;
                     35: use Apache::Constants qw(:common);
                     36: use Apache::File ();
                     37: use Apache::lonnet();
                     38: 
                     39: sub handler {
                     40:     my $r = shift;
                     41:     $r->content_type('text/html');
                     42:     $r->send_http_header;
                     43:     return OK if $r->header_only;
                     44: 
                     45:     my $iconpath= $r->dir_config('lonIconsURL');
                     46:     my $domain  = $r->dir_config('lonDefDomain');
                     47:     my $role    = $r->dir_config('lonRole');
                     48:     my $loadlim = $r->dir_config('lonLoadLim');
                     49:     my $servadm = $r->dir_config('lonAdmEMail');
                     50:     my $sysadm  = $r->dir_config('lonSysEMail');
                     51:     my $lonhost = $r->dir_config('lonHostID');
                     52:     my $tabdir  = $r->dir_config('lonTabDir');
1.6       www        53:     my $include = $r->dir_config('lonIncludes');
1.1       albertel   54: 
                     55:     my $loadavg;
                     56:    {
                     57:        my $loadfile=Apache::File->new('/proc/loadavg');
                     58:        $loadavg=<$loadfile>;
                     59:    }
                     60:     $loadavg =~ s/\s.*//g;
                     61:     my $loadpercent=100*$loadavg/$loadlim;
                     62: 
1.10      www        63:     my $otherserver='http://'.$ENV{'SERVER_NAME'};
1.5       www        64:     my $firsturl=$ENV{'request.firsturl'};
1.1       albertel   65: # ---------------------------------------- Are we access server and overloaded?
                     66:     if (($role eq 'access') && ($loadpercent>100.0)) {
                     67:         $otherserver=Apache::lonnet::spareserver();
                     68:     }
1.6       www        69: 
                     70: # -------------------------------------------------------- Set login parameters
                     71: 
                     72:     my @hexstr=('0','1','2','3','4','5','6','7',
                     73:                 '8','9','a','b','c','d','e','f');
                     74:     my $lkey='';
                     75:     for (0..7) {
                     76:         $lkey.=$hexstr[rand(15)];
                     77:     }
                     78: 
                     79:     my $ukey='';
                     80:     for (0..7) {
                     81:         $ukey.=$hexstr[rand(15)];
                     82:     }
                     83: 
                     84:     my $lextkey=hex($lkey);
                     85:     my $uextkey=hex($ukey);
                     86:     my $logtoken=Apache::lonnet::reply(
1.7       www        87:        'tmpput:'.$ukey.$lkey.'&'.$firsturl,
1.6       www        88:        $lonhost);
                     89: 
                     90: # --------------------------------------------------- Print login screen header
                     91:     $r->print(<<ENDHEADER);
1.1       albertel   92: <html>
                     93: <head>
1.2       www        94: <title>The LearningOnline Network with CAPA Login</title>
1.1       albertel   95: </head>
1.6       www        96: ENDHEADER
                     97: # ---------------------------------------------------- Serve out DES JavaScript
                     98:     {
                     99: 	my $jsh=Apache::File->new($include."/londes.js");
                    100:         $r->print(<$jsh>);
                    101:     }
                    102: # ---------------------------------------------------------- Serve rest of page
                    103:     $r->print(<<ENDDOCUMENT);
                    104: 
1.8       www       105: <body bgcolor="#FFFFFF" text="#000000" link="#999999" vlink="#999999"
                    106:  onLoad="init();">
1.6       www       107: 
                    108: <script language="JavaScript">
                    109: 
                    110:     function send() {
                    111: 	this.document.server.elements.uname.value
                    112:        =this.document.client.elements.uname.value;
                    113: 
                    114:         this.document.server.elements.udom.value
                    115:        =this.document.client.elements.udom.value;
                    116: 
                    117:         uextkey=this.document.client.elements.uextkey.value;
                    118:         lextkey=this.document.client.elements.lextkey.value;
                    119:         initkeys();
                    120: 
                    121:         this.document.server.elements.upass.value
                    122: 	    =crypted(this.document.client.elements.upass.value);
                    123: 
                    124:         this.document.server.submit();
                    125:     }
                    126: 
                    127: </script>
                    128: 
1.8       www       129: <a href="/adm/accessibility.html">Accessibility Options</a>
                    130: &nbsp;&nbsp;
                    131: <a href="/adm/about.html">About LON-CAPA</a><p>
1.1       albertel  132: <table width=600>
1.8       www       133: <tr><td>
                    134: <img src="$iconpath/lonlogo.gif"></td>
                    135: <td colspan=2 bgcolor="#DDDDDD">
1.2       www       136: <font size=+1><b>User Authentication</b></font><p>
                    137: 
1.6       www       138:  <form name="server" action="$otherserver/adm/authenticate" 
                    139:   method="post" target="_top">
                    140:   <input type=hidden name=logtoken value="$logtoken">
                    141:   <input type=hidden name=serverid value="$lonhost">
                    142:   <input type=hidden name=uname value="">
                    143:   <input type=hidden name=upass value="">
                    144:   <input type=hidden name=udom value="">
                    145:  </form>
                    146: 
                    147:  <form name="client">
1.1       albertel  148:  <table border=2 bgcolor="#BBBBBB">
                    149:  <tr><td>Username:</td><td><input type=text size=10 name=uname></td></tr>
                    150:  <tr><td>Password:</td><td><input type=password size=10 name=upass></td></tr>
                    151:  <tr><td>Domain:</td><td><input type=text size=10 value=$domain name=udom></td>
                    152:  </tr>
1.6       www       153:  <tr><td colspan=2><input type=button value=Login onClick="send();"></td></tr>
1.1       albertel  154:  </table>
1.6       www       155:  <input type=hidden name=lextkey value="$lextkey">
                    156:  <input type=hidden name=uextkey value="$uextkey">
1.1       albertel  157:  </form>
1.6       www       158: 
1.1       albertel  159: </td>
                    160: </tr><tr><td bgcolor="#DDDDDD">
                    161: <table border=1 bgcolor="#BBBBBB">
1.2       www       162: <tr><td><font size="-1"><b>Domain:</b></font></td>
                    163:     <td><font size="-1"><tt>$domain</tt></font></td>
1.9       www       164:     <td rowspan=3><font size="-1"><b>System Administration:</b><br>
1.1       albertel  165:                   <tt>$sysadm</tt><br>
                    166:                   <b>Server Administration:</b><br>
                    167:                   <tt>$servadm</tt></font></td></tr>
1.2       www       168: <tr><td><font size="-1"><b>Server:</b></font></td>
                    169:     <td><font size="-1"><tt>$lonhost ($role)</tt></font></td></tr>
                    170: <tr><td><font size="-1"><b>Load:</b></font></td>
                    171:     <td><font size="-1"><tt>$loadpercent</tt> percent</font></td></tr>
                    172: </table>
1.1       albertel  173: </td><td>
1.8       www       174: <font size="+1">
1.3       www       175: <b>L</b>aboratory&nbsp;for<br>
                    176: <b>I</b>nstructional<br>
                    177: <b>T</b>echnology&nbsp;in<br>
1.1       albertel  178: <b>E</b>ducation</td><td>
1.8       www       179: <img src="$iconpath/liteani.gif"></font></td></tr></table>
1.1       albertel  180: </body>
                    181: </html>
                    182: ENDDOCUMENT
                    183:     return OK;
                    184: } 
                    185: 
                    186: 1;
                    187: __END__

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