Annotation of loncom/auth/lonlogin.pm, revision 1.7
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.7 ! www 4: # 1/14/00,5/29,5/30,6/1,6/29,7/1 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:
79: <body bgcolor="#FFFFFF" onLoad="init();">
80:
81: <script language="JavaScript">
82:
83: function send() {
84: this.document.server.elements.uname.value
85: =this.document.client.elements.uname.value;
86:
87: this.document.server.elements.udom.value
88: =this.document.client.elements.udom.value;
89:
90: uextkey=this.document.client.elements.uextkey.value;
91: lextkey=this.document.client.elements.lextkey.value;
92: initkeys();
93:
94: this.document.server.elements.upass.value
95: =crypted(this.document.client.elements.upass.value);
96:
97: this.document.server.submit();
98: }
99:
100: </script>
101:
1.1 albertel 102: <table width=600>
103: <tr><td><img src="$iconpath/lonlogo.gif"></td>
104: <td bgcolor="#DDDDDD">
1.2 www 105: <font size=+1><b>User Authentication</b></font><p>
106:
1.6 www 107: <form name="server" action="$otherserver/adm/authenticate"
108: method="post" target="_top">
109: <input type=hidden name=logtoken value="$logtoken">
110: <input type=hidden name=serverid value="$lonhost">
111: <input type=hidden name=uname value="">
112: <input type=hidden name=upass value="">
113: <input type=hidden name=udom value="">
114: </form>
115:
116: <form name="client">
1.1 albertel 117: <table border=2 bgcolor="#BBBBBB">
118: <tr><td>Username:</td><td><input type=text size=10 name=uname></td></tr>
119: <tr><td>Password:</td><td><input type=password size=10 name=upass></td></tr>
120: <tr><td>Domain:</td><td><input type=text size=10 value=$domain name=udom></td>
121: </tr>
1.6 www 122: <tr><td colspan=2><input type=button value=Login onClick="send();"></td></tr>
1.1 albertel 123: </table>
1.6 www 124: <input type=hidden name=lextkey value="$lextkey">
125: <input type=hidden name=uextkey value="$uextkey">
1.1 albertel 126: </form>
1.6 www 127:
1.1 albertel 128: </td>
129: </tr><tr><td bgcolor="#DDDDDD">
130: <table border=1 bgcolor="#BBBBBB">
1.2 www 131: <tr><td><font size="-1"><b>Domain:</b></font></td>
132: <td><font size="-1"><tt>$domain</tt></font></td>
133: <td rowspan=3><font size="-1"><b>LON System Administration:</b><br>
1.1 albertel 134: <tt>$sysadm</tt><br>
135: <b>Server Administration:</b><br>
136: <tt>$servadm</tt></font></td></tr>
1.2 www 137: <tr><td><font size="-1"><b>Server:</b></font></td>
138: <td><font size="-1"><tt>$lonhost ($role)</tt></font></td></tr>
139: <tr><td><font size="-1"><b>Load:</b></font></td>
140: <td><font size="-1"><tt>$loadpercent</tt> percent</font></td></tr>
141: </table>
1.1 albertel 142: </td><td>
143: <table align=right><tr><td><font size="+1">
1.3 www 144: <b>L</b>aboratory for<br>
145: <b>I</b>nstructional<br>
146: <b>T</b>echnology in<br>
1.1 albertel 147: <b>E</b>ducation</td><td>
1.4 www 148: <img src="$iconpath/liteani.gif"></font></td></tr></table></td></tr></table>
1.1 albertel 149: </body>
150: </html>
151: ENDDOCUMENT
152: return OK;
153: }
154:
155: 1;
156: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>