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