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