Annotation of loncom/auth/lonlogin.pm, revision 1.19
1.1 albertel 1: # The LearningOnline Network
2: # Login Screen
1.11 www 3: #
1.19 ! bowersj2 4: # $Id: lonlogin.pm,v 1.18 2002/05/25 22:15:03 www Exp $
1.11 www 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: #
1.14 albertel 32: # 2/7/02,2/8,2/12,2/14,2/15,2/19 Josh Brunskole
1.19 ! bowersj2 33: #
! 34: # 7/10/02 Jeremy Bowers
1.14 albertel 35:
1.1 albertel 36: package Apache::lonlogin;
37:
38: use strict;
39: use Apache::Constants qw(:common);
40: use Apache::File ();
41: use Apache::lonnet();
1.12 albertel 42: use Apache::loncommon();
1.1 albertel 43:
44: sub handler {
45: my $r = shift;
46: $r->content_type('text/html');
1.12 albertel 47: &Apache::loncommon::no_cache($r);
1.1 albertel 48: $r->send_http_header;
49: return OK if $r->header_only;
50:
1.16 www 51:
52: &Apache::loncommon::get_unprocessed_cgi
53: ($ENV{'QUERY_STRING'},['interface']);
1.18 www 54:
55: $ENV{'form.interface'}=~s/\W//g;
1.16 www 56:
57: my $fullgraph=($ENV{'form.interface'} ne 'textual');
58:
1.1 albertel 59: my $iconpath= $r->dir_config('lonIconsURL');
60: my $domain = $r->dir_config('lonDefDomain');
61: my $role = $r->dir_config('lonRole');
62: my $loadlim = $r->dir_config('lonLoadLim');
63: my $servadm = $r->dir_config('lonAdmEMail');
64: my $sysadm = $r->dir_config('lonSysEMail');
65: my $lonhost = $r->dir_config('lonHostID');
66: my $tabdir = $r->dir_config('lonTabDir');
1.6 www 67: my $include = $r->dir_config('lonIncludes');
1.1 albertel 68:
69: my $loadavg;
70: {
71: my $loadfile=Apache::File->new('/proc/loadavg');
72: $loadavg=<$loadfile>;
73: }
74: $loadavg =~ s/\s.*//g;
75: my $loadpercent=100*$loadavg/$loadlim;
76:
1.10 www 77: my $otherserver='http://'.$ENV{'SERVER_NAME'};
1.5 www 78: my $firsturl=$ENV{'request.firsturl'};
1.1 albertel 79: # ---------------------------------------- Are we access server and overloaded?
80: if (($role eq 'access') && ($loadpercent>100.0)) {
81: $otherserver=Apache::lonnet::spareserver();
82: }
1.6 www 83:
84: # -------------------------------------------------------- Set login parameters
85:
86: my @hexstr=('0','1','2','3','4','5','6','7',
87: '8','9','a','b','c','d','e','f');
88: my $lkey='';
89: for (0..7) {
90: $lkey.=$hexstr[rand(15)];
91: }
92:
93: my $ukey='';
94: for (0..7) {
95: $ukey.=$hexstr[rand(15)];
96: }
97:
98: my $lextkey=hex($lkey);
1.15 www 99: if ($lextkey>2147483647) { $lextkey-=4294967296; }
100:
1.6 www 101: my $uextkey=hex($ukey);
1.15 www 102: if ($uextkey>2147483647) { $uextkey-=4294967296; }
103:
1.6 www 104: my $logtoken=Apache::lonnet::reply(
1.7 www 105: 'tmpput:'.$ukey.$lkey.'&'.$firsturl,
1.6 www 106: $lonhost);
107:
108: # --------------------------------------------------- Print login screen header
109: $r->print(<<ENDHEADER);
1.1 albertel 110: <html>
111: <head>
1.2 www 112: <title>The LearningOnline Network with CAPA Login</title>
1.1 albertel 113: </head>
1.6 www 114: ENDHEADER
115: # ---------------------------------------------------- Serve out DES JavaScript
116: {
117: my $jsh=Apache::File->new($include."/londes.js");
118: $r->print(<$jsh>);
119: }
120: # ---------------------------------------------------------- Serve rest of page
1.16 www 121: $r->print(<<ENDSCRIPT);
1.6 www 122:
1.14 albertel 123: <body bgcolor="#006600" text="#000000" link="#999999" vlink="#999999"
124: onLoad="init();" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
1.6 www 125:
1.14 albertel 126: <script language="JavaScript">
127: function send()
128: {
1.6 www 129: this.document.server.elements.uname.value
130: =this.document.client.elements.uname.value;
131:
132: this.document.server.elements.udom.value
133: =this.document.client.elements.udom.value;
134:
135: uextkey=this.document.client.elements.uextkey.value;
136: lextkey=this.document.client.elements.lextkey.value;
137: initkeys();
138:
139: this.document.server.elements.upass.value
140: =crypted(this.document.client.elements.upass.value);
141:
142: this.document.server.submit();
1.19 ! bowersj2 143: return false;
1.6 www 144: }
1.14 albertel 145: </script>
1.16 www 146: ENDSCRIPT
1.6 www 147:
1.16 www 148: if ($fullgraph) {
149: $r->print(
150: '<table width="100%" cellpadding=0 cellspacing=0 border=0>');
151: }
1.6 www 152:
1.16 www 153: $r->print(<<ENDSERVERFORM);
1.14 albertel 154: <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
155: <input type=hidden name=logtoken value="$logtoken">
156: <input type=hidden name=serverid value="$lonhost">
1.17 www 157: <input type=hidden name=interface value="$ENV{'form.interface'}">
1.14 albertel 158: <input type=hidden name=uname value="">
159: <input type=hidden name=upass value="">
160: <input type=hidden name=udom value="">
161: </form>
1.16 www 162: ENDSERVERFORM
163: if ($fullgraph) { $r->print(<<ENDTOP);
1.14 albertel 164: <!-- The LON-CAPA Header -->
165: <tr>
166:
167: <!-- Row 1 Columns 2-4 -->
1.19 ! bowersj2 168: <td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="#006600"><img src="$iconpath/header.gif" border=0 alt="The Learning Online Network with CAPA" /></td>
1.14 albertel 169: </tr>
170:
171: <!-- The gray bar that starts the two table frames -->
172: <tr>
173:
174: <!-- Row 2 Column 1 -->
175: <td width=182 height=27 bgcolor="#cccccc"> </td>
176:
177: <!-- Row 2 Column 2 -->
1.19 ! bowersj2 178: <td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td>
1.14 albertel 179:
180: <!-- Row 2 Column 3 -->
1.19 ! bowersj2 181: <td height=27 background="$iconpath/filltop.gif"><img src="$iconpath/filltop.gif" alt="" /></td>
1.14 albertel 182:
183: <!-- Row 2 Column 4 -->
1.19 ! bowersj2 184: <td width=27 height=27 align="right" background="$iconpath/filltop.gif"><img src="$iconpath/upperright.gif" border=0 alt="" /></td>
1.14 albertel 185: </tr>
186: <tr>
187:
188: <!-- A cell that will hold the 'access' and 'about' buttons -->
189: <!-- Row 3 Column 1 -->
190: <td valign="top" height=60 align="center" bgcolor="#cccccc">
1.19 ! bowersj2 191: <a href="/adm/login?interface=textual"><img src="$iconpath/accessbutton.gif" border=0 alt="Accessibility Options" /></a>
1.14 albertel 192: <br />
1.19 ! bowersj2 193: <a href="/adm/about.html"><img src="$iconpath/aboutlon.gif" border=0 alt="About LON-CAPA" /></a>
1.14 albertel 194: </td>
195:
196: <!-- The shaded space between the two main columns -->
197: <!-- Row 3 Column 2 -->
1.19 ! bowersj2 198: <td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.14 albertel 199:
200: <!-- The right main column holding the large LON-CAPA logo-->
201: <!-- Rows 3-4 Column 3 -->
202: <td align="center" valign="top" width="100%" height="100%" rowspan=2 bgcolor="#ffffff">
203: <center>
1.19 ! bowersj2 204: <img src="$iconpath/loncapalogo.gif" alt="" />
1.14 albertel 205: </center>
206: </td>
207:
208: <!-- Row 3 Column 4 -->
1.19 ! bowersj2 209: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 210: </tr>
211: <tr>
212:
213: <!-- The entry form -->
214: <!-- Row 4 Column 1 -->
215: <td align="center" valign="middle" bgcolor="#cccccc">
1.16 www 216: ENDTOP
217: }
218: $r->print(<<ENDLOGIN);
1.19 ! bowersj2 219: <form name="client" onsubmit="return(send())">
1.14 albertel 220: <input type="hidden" name="lextkey" value="$lextkey">
221: <input type="hidden" name="uextkey" value="$uextkey">
222:
223: <!-- Start the sub-table for text and input alignment -->
224: <table border=0 cellspacing=0 cellpadding=0>
1.19 ! bowersj2 225: <tr><td bgcolor="#cccccc" colspan=2><img src="$iconpath/userauthentication.gif" alt="User Authentication" /></td></tr>
1.14 albertel 226: <tr>
227: <td bgcolor="#ffffff"><br /><font size=-1><b> User Name:</b></font></td>
228: <td bgcolor="#ffffff"><br /><input type="text" name="uname" size="10" /></td>
229: </tr>
230: <tr>
231: <td bgcolor="#ffffff"><font size=-1><b> Password:</b></font></td>
232: <td bgcolor="#ffffff"><input type="password" name="upass" size="10" /></td>
233: </tr>
234: <tr>
235: <td bgcolor="#ffffff"><font size=-1><b> Domain:</b></font></td>
236: <td bgcolor="#ffffff"><input type="text" name="udom" size="10" value=$domain /></td>
237: </tr>
238: <tr>
239: <td bgcolor="#ffffff" valign="bottom" align="center" colspan=2>
240: <br />
1.19 ! bowersj2 241: <input type="submit" value="Log In" />
1.14 albertel 242: </td>
243: </tr>
244: </table>
245: <!-- End sub-table -->
246: </form>
1.16 www 247: ENDLOGIN
248: if ($fullgraph) {
249: $r->print(<<ENDDOCUMENT);
1.14 albertel 250: </td>
251:
252: <!-- Row 4 Column 2 -->
1.19 ! bowersj2 253: <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.14 albertel 254:
255: <!-- Row 4 Column 4 -->
1.19 ! bowersj2 256: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 257: </tr>
258: <tr>
259:
260: <!-- Row 5 Column 1 -->
261: <td bgcolor="#cccccc" valign="middle" align="left">
262: <br />
263: <table border=0 cellspacing=0 cellpadding=0>
264: <tr>
265: <td bgcolor="#cccccc" align="left" valign="top">
266: <small><b> Domain: </b></small>
267: </td>
268: <td bgcolor="#cccccc" align="left" valign="top">
269: <small><tt> $domain</tt></small>
270: </td>
271: </tr>
272: <tr>
273: <td bgcolor="#cccccc" align="left" valign="top">
274: <small><b> Server: </b></small>
275: </td>
276: <td bgcolor="#cccccc" align="left" valign="top">
277: <small><tt> $lonhost ($role)</tt></small>
278: </td>
279: </tr>
280: <tr>
281: <td bgcolor="#cccccc" align="left" valign="top">
282: <small><b> Load: </b></small>
283: </td>
284: <td bgcolor="#cccccc" align="left" valign="top">
285: <small><tt> $loadpercent percent</tt></small>
286: </td>
287: </tr>
288: </table>
289: <br />
290: <small>
291: <b> System Administration:</b><br />
292: <tt> $sysadm</tt><br />
293: <b> Server Administration:</b><br />
1.19 ! bowersj2 294: <tt> $servadm<br /> </tt>
1.14 albertel 295: </small>
296: </td>
297:
298: <!-- Row 5 Column 2 -->
1.19 ! bowersj2 299: <td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td>
1.14 albertel 300:
301: <!-- Row 5 Column 3 -->
1.19 ! bowersj2 302: <td width="100%" valign="bottom" bgcolor="#ffffff"><img src="$iconpath/litetext.gif" alt="Laboratory for Instructional Technology in Education" /><img src="$iconpath/lite.gif" alt="" /></td>
1.14 albertel 303:
304: <!-- Row 5 Column 4 -->
1.19 ! bowersj2 305: <td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td>
1.14 albertel 306: </tr>
307: <tr>
308:
309: <!-- Row 6 Column 1 -->
310: <td bgcolor="#cccccc"> </td>
311:
312: <!-- Row 6 Column 2 -->
1.19 ! bowersj2 313: <td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td>
1.14 albertel 314:
315: <!-- Row 6 Column 3 -->
1.19 ! bowersj2 316: <td background="$iconpath/fillbottom.gif"><img src="$iconpath/fillbottom.gif" alt="" /></td>
1.14 albertel 317:
318: <!-- Row 6 Column 4 -->
1.19 ! bowersj2 319: <td align="right" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerright.gif" alt="" /></td>
1.14 albertel 320: </tr>
1.1 albertel 321: </table>
1.14 albertel 322:
1.1 albertel 323: ENDDOCUMENT
1.16 www 324: }
325: $r->print('</body></html>');
1.1 albertel 326: return OK;
327: }
328:
329: 1;
330: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>