Annotation of modules/gci/lonlogin.pm, revision 1.9
1.1 gci 1: # The LearningOnline Network
2: # Login Screen
3: #
1.9 ! gci 4: # $Id: lonlogin.pm,v 1.8 2010/01/09 00:57:14 gci Exp $
1.1 gci 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: #
28:
29: package Apache::lonlogin;
30:
31: use strict;
32: use Apache::Constants qw(:common);
33: use Apache::File ();
34: use Apache::lonnet;
35: use Apache::loncommon();
36: use Apache::lonauth();
37: use Apache::lonlocal;
38: use Apache::migrateuser();
39: use lib '/home/httpd/lib/perl/';
40: use LONCAPA;
1.9 ! gci 41: use HTML::Entities();
1.1 gci 42:
43: sub handler {
44: my $r = shift;
45:
46: &Apache::loncommon::get_unprocessed_cgi
47: (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
48: $ENV{'REDIRECT_QUERY_STRING'}),
49: ['interface','username','domain','firsturl','localpath','localres',
1.2 gci 50: 'token','role','symb']);
1.1 gci 51: if (!defined($env{'form.firsturl'})) {
52: &Apache::lonacc::get_posted_cgi($r,['firsturl']);
53: }
54:
55: # -- check if they are a migrating user
56: if (defined($env{'form.token'})) {
57: return &Apache::migrateuser::handler($r);
58: }
59:
60: &Apache::loncommon::no_cache($r);
61: &Apache::lonlocal::get_language_handle($r);
62: &Apache::loncommon::content_type($r,'text/html');
63: $r->send_http_header;
64: return OK if $r->header_only;
65:
66:
67: # Are we re-routing?
68: if (-e '/home/httpd/html/lon-status/reroute.txt') {
69: &Apache::lonauth::reroute($r);
70: return OK;
71: }
72:
73:
74: # -------------------------------- Prevent users from attempting to login twice
75: my $handle = &Apache::lonnet::check_for_valid_session($r);
76: if ($handle=~/^publicuser\_/) {
77: # For "public user" - remove it, we apparently really want to login
78: unlink($r->dir_config('lonIDsDir')."/$handle.id");
79: } elsif ($handle ne '') {
80: # Indeed, a valid token is found
81: my $start_page =
82: &Apache::loncommon::start_page('Already logged in');
83: my $end_page =
84: &Apache::loncommon::end_page();
1.4 gci 85: my $dest = '/adm/roles';
1.9 ! gci 86: if ($env{'form.role'}) {
! 87: $dest .= '?selectrole=1&'.$env{'form.role'}.'=1';
! 88: }
! 89: if ($env{'form.symb'}) {
! 90: $dest .= ($dest =~ /\?/) ? '&' : '?';
! 91: $dest .= 'destinationurl='.&HTML::Entities::encode($env{'form.symb'},'"&<>');
! 92: }
1.4 gci 93: if ($env{'form.firsturl'} ne '') {
94: $dest = $env{'form.firsturl'};
95: }
1.1 gci 96: $r->print(
97: $start_page
98: .'<h1>'.&mt('You are already logged in!').'</h1>'
1.2 gci 99: .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
1.4 gci 100: '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
1.1 gci 101: .'<p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'
102: .$end_page
103: );
104: return OK;
105: }
106:
107: # ---------------------------------------------------- No valid token, continue
108:
109: # ---------------------------- Not possible to really login to domain "public"
110: if ($env{'form.domain'} eq 'public') {
111: $env{'form.domain'}='';
112: $env{'form.username'}='';
113: }
114: # ----------------------------------------------------------- Process Interface
115: $env{'form.interface'}=~s/\W//g;
116:
117: my $textbrowsers=$r->dir_config('lonTextBrowsers');
118: my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
119:
120: foreach (split(/\:/,$textbrowsers)) {
121: if ($httpbrowser=~/$_/i) {
122: $env{'form.interface'}='textual';
123: }
124: }
125:
126: my $fullgraph=($env{'form.interface'} ne 'textual');
127:
128: my $iconpath=
129: &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
130:
131: my $domain = &Apache::lonnet::default_login_domain();
132: if (($env{'form.domain'}) &&
133: (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
134: $domain=$env{'form.domain'};
135: }
1.4 gci 136: my $sitename = 'GCI WebCenter';
137: my $shortsitename = 'WebCenter';
138: my $existing = 'Existing WebCenter user?';
139: my $sitedesc = &mt('The Geoscience Concept Inventory (GCI) [_1]WebCenter[_2] is a place to comment on existing concept questions, or submit new ones, and is also a place to build and manage Concept Tests which your students will complete via the [_3]Testing Center[_2].','<a href="http://gci.lite.msu.edu/">','</a>','<a href="http://gcitest.lite.msu.edu/adm/login">');
1.1 gci 140: my $role = $r->dir_config('lonRole');
141: my $loadlim = $r->dir_config('lonLoadLim');
142: my $servadm = $r->dir_config('lonAdmEMail');
143: my $lonhost = $r->dir_config('lonHostID');
144: my $tabdir = $r->dir_config('lonTabDir');
145: my $include = $r->dir_config('lonIncludes');
146: my $expire = $r->dir_config('lonExpire');
147: my $version = $r->dir_config('lonVersion');
148: my $host_name = &Apache::lonnet::hostname($lonhost);
1.4 gci 149: if ($domain eq 'gcitest') {
1.5 gci 150: $lonhost = 'gcitestl1';
151: $host_name = 'gcitest.lite.msu.edu';
1.4 gci 152: $sitename = 'GCI Testing Center';
153: $shortsitename = 'Testing Center';
154: $existing = 'Student with Testing Center account?';
155: $sitedesc = &mt('The GCI Testing Center is used by [_1]students[_2] to complete online concept tests created by their instructors using questions available in the Geoscience Concept Inventory.','<i>','</i>');
156: }
1.1 gci 157:
158: # --------------------------------------------- Default values for login fields
159:
160: my $authusername=($env{'form.username'}?$env{'form.username'}:'');
161: my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
162:
163: # ---------------------------------------------------------- Determine own load
164: my $loadavg;
165: {
166: my $loadfile=Apache::File->new('/proc/loadavg');
167: $loadavg=<$loadfile>;
168: }
169: $loadavg =~ s/\s.*//g;
170: my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
171: my $userloadpercent=&Apache::lonnet::userload();
172:
173: # ------------------------------------------------------- Do the load balancing
174: my $otherserver= &Apache::lonnet::absolute_url($host_name);
175: my $firsturl=
176: ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
177: # ---------------------------------------------------------- Are we overloaded?
178: if ((($userloadpercent>100.0)||($loadpercent>100.0))) {
179: my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent);
180: if ($unloaded) { $otherserver=$unloaded; }
181: }
182:
183: # ----------------------------------------------------------- Get announcements
184: my $announcements=&Apache::lonnet::getannounce();
185: # -------------------------------------------------------- Set login parameters
186:
187: my @hexstr=('0','1','2','3','4','5','6','7',
188: '8','9','a','b','c','d','e','f');
189: my $lkey='';
190: for (0..7) {
191: $lkey.=$hexstr[rand(15)];
192: }
193:
194: my $ukey='';
195: for (0..7) {
196: $ukey.=$hexstr[rand(15)];
197: }
198:
199: my $lextkey=hex($lkey);
200: if ($lextkey>2147483647) { $lextkey-=4294967296; }
201:
202: my $uextkey=hex($ukey);
203: if ($uextkey>2147483647) { $uextkey-=4294967296; }
204:
205: # -------------------------------------------------------- Store away log token
1.2 gci 206: my $tokenextras;
207: if ($env{'form.role'}) {
208: $tokenextras = '&role='.&escape($env{'form.role'});
209: }
1.6 gci 210: if ($domain eq 'gci') {
1.9 ! gci 211: unless ($env{'form.symb'} eq '/adm/statistics') {
! 212: $env{'form.symb'} = '/adm/gci_info';
! 213: }
1.6 gci 214: }
1.2 gci 215: if ($env{'form.symb'}) {
216: if (!$tokenextras) {
217: $tokenextras = '&';
218: }
219: $tokenextras .= '&symb='.&escape($env{'form.symb'});
220: }
1.1 gci 221: my $logtoken=Apache::lonnet::reply(
1.6 gci 222: 'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
1.1 gci 223: $lonhost);
224:
225: # ------------------- If we cannot talk to ourselves, we are in serious trouble
226:
227: if ($logtoken eq 'con_lost') {
228: my $spares='';
229: my $last;
230: foreach my $hostid (sort
231: {
232: &Apache::lonnet::hostname($a) cmp
233: &Apache::lonnet::hostname($b);
234: }
235: keys(%Apache::lonnet::spareid)) {
236: next if ($hostid eq $lonhost);
237: my $hostname = &Apache::lonnet::hostname($hostid);
238: next if ($last eq $hostname);
239: $spares.='<br /><font size="+1"><a href="http://'.
240: $hostname.
241: '/adm/login?domain='.$authdomain.'">'.
242: $hostname.'</a>'.
243: ' '.&mt('(preferred)').'</font>'.$/;
244: $last=$hostname;
245: }
246: $spares.= '<br />';
247: my %all_hostnames = &Apache::lonnet::all_hostnames();
248: foreach my $hostid (sort
249: {
250: &Apache::lonnet::hostname($a) cmp
251: &Apache::lonnet::hostname($b);
252: }
253: keys(%all_hostnames)) {
254: next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
255: my $hostname = &Apache::lonnet::hostname($hostid);
256: next if ($last eq $hostname);
257: $spares.='<br /><a href="http://'.
258: $hostname.
259: '/adm/login?domain='.$authdomain.'">'.
260: $hostname.'</a>';
261: $last=$hostname;
262: }
263: $r->print(
264: '<html>'
265: .'<head><title>'
266: .&mt('The LearningOnline Network with CAPA')
267: .'</title></head>'
268: .'<body bgcolor="#FFFFFF">'
269: .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
270: .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
1.4 gci 271: .'<h3>'.&mt("The $sitename server is temporarily not available for login.").'</h3>'
1.1 gci 272: .'</body>'
273: .'</html>'
274: );
275: return OK;
276: }
277:
278: # ----------------------------------------------- Apparently we are in business
279: $servadm=~s/\,/\<br \/\>/g;
280:
281: # ----------------------------------------------------------- Front page design
282: my $pgbg=
283: ($fullgraph?&Apache::loncommon::designparm('login.pgbg',$domain):'#FFFFFF');
284: my $font=
285: ($fullgraph?&Apache::loncommon::designparm('login.font',$domain):'#000000');
286: my $link=
287: ($fullgraph?&Apache::loncommon::designparm('login.link',$domain):'#0000FF');
288: my $vlink=
289: ($fullgraph?&Apache::loncommon::designparm('login.vlink',$domain):'#0000FF');
290: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
291: my $mainbg=
292: ($fullgraph?&Apache::loncommon::designparm('login.mainbg',$domain):'#FFFFFF');
293: my $sidebg=
294: ($fullgraph?&Apache::loncommon::designparm('login.sidebg',$domain):'#FFFFFF');
295: my $textcol =
296: ($fullgraph?&Apache::loncommon::designparm('login.textcol',$domain):'#000000');
297: my $bgcol =
298: ($fullgraph?&Apache::loncommon::designparm('login.bgcol',$domain):'#FFFFFF');
299: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
300: my $img=&Apache::loncommon::designparm('login.img',$domain);
301: my $domainlogo=&Apache::loncommon::domainlogo($domain);
302: my $login=&Apache::loncommon::designparm('login.login',$domain);
303: if ($login eq '') {
304: $login = $iconpath.'/'.&mt('userauthentication.gif');
305: }
306: my $showbanner = 1;
307: my $showmainlogo = 1;
308: if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
309: $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
310: }
311: if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
312: $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
313: }
314: my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
315: my $showcoursecat =
316: &Apache::loncommon::designparm('login.coursecatalog',$domain);
317: my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain);
318: my $shownewuserlink =
319: &Apache::loncommon::designparm('login.newuser',$domain);
320: my $now=time;
321: my $js = (<<ENDSCRIPT);
322:
1.2 gci 323: <script type="text/javascript" language="JavaScript">
1.4 gci 324: // <![CDATA[
325:
1.1 gci 326: function send(caller)
327: {
328:
329: if (caller == "newaccount") {
330: this.document.signup.submit();
331: return false;
332: }
333: if (document.client.uname.value == "" || !document.client.uname.value) {
334: alert("You must provide a username ");
335: return false;
336: }
337: if (document.client.upass$now.value == "" || !document.client.upass$now.value) {
338: alert("You must provide a password");
339: return false;
340: }
341:
342: this.document.server.elements.uname.value
343: =this.document.client.elements.uname.value;
344:
345: this.document.server.elements.udom.value
346: =this.document.client.elements.udom.value;
347:
348: this.document.server.elements.imagesuppress.value
349: =this.document.client.elements.imagesuppress.checked;
350:
351: this.document.server.elements.embedsuppress.value
352: =this.document.client.elements.embedsuppress.checked;
353:
354: this.document.server.elements.appletsuppress.value
355: =this.document.client.elements.appletsuppress.checked;
356:
357: this.document.server.elements.fontenhance.value
358: =this.document.client.elements.fontenhance.checked;
359:
360: this.document.server.elements.blackwhite.value
361: =this.document.client.elements.blackwhite.checked;
362:
363: this.document.server.elements.remember.value
364: =this.document.client.elements.remember.checked;
365:
366: uextkey=this.document.client.elements.uextkey.value;
367: lextkey=this.document.client.elements.lextkey.value;
368: initkeys();
369:
370: this.document.server.elements.upass0.value
371: =crypted(this.document.client.elements.upass$now.value.substr(0,15));
372: this.document.server.elements.upass1.value
373: =crypted(this.document.client.elements.upass$now.value.substr(15,15));
374: this.document.server.elements.upass2.value
375: =crypted(this.document.client.elements.upass$now.value.substr(30,15));
376:
377: this.document.client.elements.uname.value='';
378: this.document.client.elements.upass$now.value='';
379:
380: this.document.server.submit();
381: return false;
382: }
1.4 gci 383: // ]]>
1.1 gci 384: </script>
1.4 gci 385:
1.1 gci 386: ENDSCRIPT
387:
388: # --------------------------------------------------- Print login screen header
389:
390: my %add_entries = (topmargin => "0",
391: leftmargin => "0",
392: marginheight => "0",
393: marginwidth => "0",
394: bgcolor => "$pgbg",
395: text => "$font",
396: link => "$link",
397: vlink => "$vlink",
398: alink => "$alink",
399: onload => "if ( document.client.uname ) { document.client.uname.focus(); }",
400: marginheight => "0",);
401:
1.4 gci 402: my $css_url = "/css/$domain/login.css";
403: $js .= "\n".'<link type="text/css" rel="stylesheet" href="'.$css_url.'">'."\n";
1.1 gci 404: $r->print(&Apache::loncommon::start_page('GCI WebCenter Login',$js,
405: { 'redirect' => [$expire,'/adm/roles'],
406: 'add_entries' => \%add_entries,
407: 'only_body' => 1,}));
408:
409: # ----------------------------------------------------------------------- Texts
410:
411: my %lt=&Apache::lonlocal::texthash(
412: 'un' => 'Username',
413: 'pw' => 'Password',
414: 'dom' => 'Domain',
415: 'load' => 'Server Load',
416: 'userload' => 'User Load',
417: 'about' => 'About LON-CAPA',
418: 'access' => 'Accessibility Options',
419: 'catalog' => 'Course Catalog',
420: 'log' => 'Log in',
421: 'help' => 'Log-in Help',
422: 'serv' => 'Server',
423: 'servadm' => 'Server Administration',
424: 'helpdesk' => 'Contact Helpdesk',
425: 'forgotpw' => 'Forgot password?',
426: 'newuser' => 'New User?',
427: 'options_headline' => 'Select Accessibility Options',
428: 'sprs_img' => 'Suppress rendering of images',
429: 'sprs_applet' => 'Suppress Java applets',
430: 'sprs_embed' => 'Suppress rendering of embedded multimedia',
431: 'sprs_font' => 'Increase font size',
432: 'sprs_blackwhite' => 'Switch to black and white mode',
433: 'remember' => 'Remember these settings for next login',
434: 'tbli' => 'Text-based Interface Login');
435: # -------------------------------------------------- Change password field name
436: my $forgotpw = &forgotpwdisplay(%lt);
437: my $loginhelp = &loginhelpdisplay(%lt);
438:
439: # ---------------------------------------------------- Serve out DES JavaScript
440: {
441: my $jsh=Apache::File->new($include."/londes.js");
442: $r->print(<$jsh>);
443: }
444: # ---------------------------------------------------------- Serve rest of page
445:
446: my $coursecatalog;
447: if (($showcoursecat eq '') || ($showcoursecat)) {
448: $coursecatalog = &coursecatalog_link($lt{'catalog'},$fullgraph);
449: }
450: my $newuserlink;
451: if ($shownewuserlink) {
452: $newuserlink = &newuser_link($lt{'newuser'});
453: }
454: if ($fullgraph) {
1.4 gci 455: $r->print(<<"END_OF_BLOCK1");
1.1 gci 456: <br />
457: <div align="center">
458: <table class="LC_loginbox">
459: <tr>
1.4 gci 460: <td align="left" valign="top" width="11">
461: <img name="login_r1_c1" src="/images/login/$domain/r1_c1.png" width="11" height="11" border="0" alt="">
1.1 gci 462: </td>
463: <td width="450" valign="top">
464: <table class="LC_loginbox_left">
465: <tr>
1.4 gci 466: <td width="411" align="left"><br /><img src="/images/login/$domain/logo_smrnd.png" width="411" height="51" alt="GCI" align="left"></td>
1.1 gci 467: </tr>
468: <tr>
469: <td>
470: <div align="left" style="display:block; margin-top:5px; margin-bottom:5px; margin-left:0px; margin-right:0px; width:440px; height:5px;">
1.4 gci 471: <div class="divider">
1.1 gci 472: </div>
473: </div>
474: </td>
475: </tr>
476: </table>
477: <table class="LC_loginbox_left">
478: <tr>
479: <td height="10" colspan="4"> </td>
480: </tr>
481: <tr>
482: <td width="10"> </td>
483: <td valign="top" class="bodyblue" width="430" align="left">
1.4 gci 484: <span style="font-size: 18px; line-height: 22px; "><font style="font-size: 18px; line-height: 22px;"><br />New to the $sitename?</font></span><br />
485: <font class="bodyblue">$sitedesc<br /><br />The $shortsitename runs on <a href="http://loncapa.org/">LON-CAPA</a> - an open source freeware distributed learning content management and assessment system.</font><br /><br />
486: END_OF_BLOCK1
487: if ($domain eq 'gci') {
488: $r->print(<<"END_OF_BLOCK2");
489: <font class="bodyblue"><b>Create a GCI WebCenter ID</b> – use your ID to submit comments or new content, or to create a new test. If you are already a GCI WebCenter user, please log-in.</font><br /><br /><br />
1.1 gci 490: <form name="signup" method="post" action="/adm/createaccount?courseid=gci_9615072b469884921gcil1"><input type="hidden" name="process" value="signup"/>
491: <table class="LC_signup">
492: <tr>
1.4 gci 493: <td align="left" valign="top" width="11" height="11"><img src="/images/login/$domain/r2_c4.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 494: <td> </td>
1.4 gci 495: <td align="right" valign="top" width="11" height="11"><img src="/images/login/$domain/r2_c6.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 496: </tr>
497: <tr>
1.7 gci 498: <td> </td>
1.8 gci 499: <td align="center" valign="middle"><span style="white-space: nowrap;">New to GCI WebCenter: <a href="javascript:send('newaccount')" style="color: #ffffff">Click here to sign up</a></span></td>
1.7 gci 500: <td> </td>
1.1 gci 501: </tr>
502: <tr>
1.4 gci 503: <td align="left" valign="bottom" width="11" height="11"><img src="/images/login/$domain/r8_c4.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 504: <td> </td>
1.4 gci 505: <td align="right" valign="bottom" width="11" height="11"><img src="/images/login/$domain/r8_c6.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 506: </tr>
507: </table>
508: </form>
1.4 gci 509: END_OF_BLOCK2
510: } else {
511: $r->print('<font class="bodyblue">'.
512: &mt("If you are already a $sitename user, please log-in.").' '.&mt('If not, contact your instructor to request a username and password.').
513: '</font><br /><br /><br />');
514: }
515: $r->print(<<"END_OF_BLOCK3");
1.1 gci 516: </td>
517: </tr>
518: </table>
519: </td>
520: <td width="10"> </td>
521: <td valign="top">
1.4 gci 522: <form name="client" method="post" onsubmit="return(send());">
1.1 gci 523: <table class="LC_loginbox_right">
524: <tr>
525: <td colspan="3" height="23" class="LC_loginbox_strip"> </td>
526: </tr>
527: <tr>
1.4 gci 528: <td align="left" valign="top" width="11" height="11"><img src="/images/login/$domain/r2_c4.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 529: <td> </td>
1.4 gci 530: <td align="right" valign="top" width="11" height="11"><img src="/images/login/$domain/r2_c6.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 531: </tr>
532: <tr>
533: <td width="10"> </td>
534: <td>
535: <table border="0" cellspacing="0" cellpadding="0">
536: <tr>
537: <td align="right" class="bodywhite" height=50><br>
538: <span style="font-size: 15px; line-height: 17px; font-weight: bold;">
1.4 gci 539: $existing</span>
1.1 gci 540: <br />Please log-in.<br>
1.4 gci 541: <hr class="login"><br /><br />
1.1 gci 542: </td>
543: </tr>
544: <tr>
545: <td>
546: <table border="0" cellpadding="2" cellspacing="0">
547: <tr>
548: <td align="right" class="bodywhite"><label for="uname">$lt{'un'}</label>:</td>
549: <td align="right"><input type="text" name="uname" size="17" value="$authusername" /></td>
550: </tr>
551: <tr>
552: <td align="right" class="bodywhite"><label for="upass$now">$lt{'pw'}</label>:</td>
1.4 gci 553: <td align="right"><input name="upass$now" size="17" value="" type="password"><input type="hidden" name="udom" value="$domain" /></td>
1.1 gci 554: </tr>
555: <tr><td> </td></tr>
556: <tr>
557: <td colspan="2" align="right"><input name="signin" type="submit" value="Log-in" class=buttonwhite /></td>
558: </tr>
559: </table>
560: </td>
561: </tr>
562: <tr>
563: <td align="right" valign="top" class="bodywhite">
564: <br />
565: <br /><br />
1.4 gci 566: <hr class="login" />
1.1 gci 567: <br />
568: <a href="/adm/resetpw" style="color: #ffffff">Forgot your password?</a><br>
569: <br />
570: </td>
571: </tr>
572: </table>
573: </td>
574: <td width="9"> </td>
575: </tr>
576: <tr>
1.4 gci 577: <td align="left" valign="bottom" width="11" height="11"><img src="/images/login/$domain/r8_c4.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 578: <td> </td>
1.4 gci 579: <td align="right" valign="bottom" width="11" height="11"><img src="/images/login/$domain/r8_c6.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 580: </tr>
581: <tr>
582: <td colspan="3" height="10" class="LC_loginbox_strip"> </td>
583: </tr>
584: </table>
585: </td>
1.4 gci 586: <td align="right" valign="top" width="11"><img src="/images/login/$domain/r1_c7.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 587: </tr>
588: <tr>
589: <td colspan="4">
1.7 gci 590: <div align="left">
1.1 gci 591: <table border="0" cellspacing="0" cellpadding="0">
592: <tr>
593: <td width="10"> </td>
594: <td><font size="-1">
1.7 gci 595: <b>Note</b>:<br />
1.1 gci 596: If log-in fails, it may be because your browser is not accepting session cookies, or javascript is disabled. <a href="http://loncapa.msu.edu/student/cookies.html">Learn more</a>.
597: </font>
598: </td>
599: <td width="10"> </td>
600: </tr>
601: </table>
1.7 gci 602: </div>
1.1 gci 603: </td>
604: </tr>
605: <tr>
1.4 gci 606: <td align="left" valign="bottom" width="11"><img src="/images/login/$domain/r9_c1.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 607: <td colspan="3" width="698"> </td>
1.4 gci 608: <td align="right" valign="bottom" width="11"><img src="/images/login/$domain/r9_c7.png" width="11" height="11" border="0" alt=""></td>
1.1 gci 609: </tr>
610: </table>
611: </div>
612: <p> </p>
613: <noscript><font size='3'> <b>Please Note:</b>
614: Javascript must be enabled in your web browser in order to use this web site.
615: </font></noscript>
616: <p> </p>
617: <input type="hidden" name="imagesuppress" value="" />
618: <input type="hidden" name="embedsuppress" value="" />
619: <input type="hidden" name="appletsuppress" value="" />
620: <input type="hidden" name="fontenhance" value="" />
621: <input type="hidden" name="blackwhite" value="" />
622: <input type="hidden" name="remember" value="" />
1.4 gci 623: END_OF_BLOCK3
1.1 gci 624: } else {
625: $r->print(<<ENDACCESSOPTIONS);
626: <h1>The Learning<i>Online</i> Network with CAPA</h1>
627: <h2>$lt{'tbli'}</h2>$announcements
628: <h3>$lt{'options_headline'}</h3>
1.2 gci 629: <form name="client" action="" onsubmit="return(send())">
1.1 gci 630: <label><input type="checkbox" name="imagesuppress" /> $lt{'sprs_img'}</label><br />
631: <label><input type="checkbox" name="appletsuppress" /> $lt{'sprs_applet'}</label><br />
632: <label><input type="checkbox" name="embedsuppress" /> $lt{'sprs_embed'}</label><br />
633: <label><input type="checkbox" name="fontenhance" /> $lt{'sprs_font'}</label><br />
634: <label><input type="checkbox" name="blackwhite" /> $lt{'sprs_blackwhite'}</label><br />
635: <br />
636: <input type="checkbox" name="remember" /> $lt{'remember'}
637: ENDACCESSOPTIONS
638: }
639: $r->print('
1.2 gci 640: <input type="hidden" name="lextkey" value="'.$lextkey.'" />
641: <input type="hidden" name="uextkey" value="'.$uextkey.'" />
1.1 gci 642: ');
643: unless ($fullgraph) {
644: my $logintitle;
645: if ($loginheader eq 'text') {
646: $logintitle = '<td bgcolor="'.$bgcol.'" colspan="2"> <b><font size="+1" color="'.$textcol.'">'.$lt{'log'}.'</font></b></td>';
647: } else {
648: $logintitle = '<td bgcolor="'.$sidebg.'" colspan="2"><img src="'.$login.'" alt="'.
649: &mt('User Authentication').'" /></td>';
650: }
651: my $noscript_warning='<td colspan="2" bgcolor="'.$mainbg.'">'
652: .'<noscript><div class="LC_warning"><font size="-1">'
653: .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
654: .'</font></div></noscript></td>';
655: $r->print(<<ENDTEXTUAL);
656: <hr />
1.4 gci 657: <table border="0" cellspacing="0" cellpadding="0">
1.1 gci 658: <tr>$logintitle</tr>
659: <tr>$noscript_warning</tr>
660: <tr>
661: <td bgcolor="$mainbg"><br /><font size=-1><b> <label for="uname">$lt{'un'}</label>:</b></font></td>
662: <td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td>
663: </tr>
664: <tr>
665: <td bgcolor="$mainbg"><font size=-1><b> <label for="upass$now">$lt{'pw'}</label>:</b></font></td>
666: <td bgcolor="$mainbg"><input type="password" name="upass$now" size="10" /></td>
667: </tr>
668: <tr>
669: <td bgcolor="$mainbg"> </td>
670: <td bgcolor="$mainbg" valign="bottom" align="center">
671: <br />
672: <input type="submit" value="$lt{'log'}" />
1.4 gci 673: <input type="hidden" name="udom" value="$domain" />
1.1 gci 674: </td>
675: </tr>
676: <tr>
677: <td bgcolor="$mainbg" valign="bottom" align="left" colspan="2">
678: $loginhelp
679: $forgotpw
680: $newuserlink
681: $coursecatalog
682: <br />
683: </td>
684: </tr>
685: </table>
686: ENDTEXTUAL
687: }
688: $r->print(<<"ENDLOGIN");
689: </form>
690: <form name="server" action="$otherserver/adm/authenticate" method="post" target="_top">
691: <input type="hidden" name="logtoken" value="$logtoken" />
692: <input type="hidden" name="serverid" value="$lonhost" />
693: <input type="hidden" name="interface" value="$env{'form.interface'}" />
694: <input type="hidden" name="uname" value="" />
695: <input type="hidden" name="upass0" value="" />
696: <input type="hidden" name="upass1" value="" />
697: <input type="hidden" name="upass2" value="" />
698: <input type="hidden" name="udom" value="" />
699: <input type="hidden" name="imagesuppress" value="" />
700: <input type="hidden" name="appletsuppress" value="" />
701: <input type="hidden" name="embedsuppress" value="" />
702: <input type="hidden" name="fontenhance" value="" />
703: <input type="hidden" name="blackwhite" value="" />
704: <input type="hidden" name="remember" value="" />
705: <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
706: <input type="hidden" name="localres" value="$env{'form.localres'}" />
707: </form>
708: ENDLOGIN
709: if ($fullgraph) {
710: my $helpdeskscript;
711: my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
712: $version,$authdomain,\$helpdeskscript);
713: }
714: my %endargs = ( 'noredirectlink' => 1, );
715: $r->print(&Apache::loncommon::end_page(\%endargs));
716: return OK;
717: }
718:
719: sub contactdisplay {
720: my ($lt,$servadm,$showadminmail,$version,$authdomain,$helpdeskscript) = @_;
721: my $contactblock;
722: my $showhelpdesk = 0;
723: my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
724: if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
725: $showhelpdesk = 1;
726: }
727: if ($servadm && $showadminmail) {
728: $contactblock .= '<b> '.$$lt{'servadm'}.':</b><br />'.
729: '<tt> '.$servadm.'</tt><br /> <br />';
730: }
731: if ($showhelpdesk) {
732: $contactblock .= '<b> <a href="javascript:helpdesk()"><font size="+1">'.$lt->{'helpdesk'}.'</font></a></b><br />';
733: my $thisurl = &escape('/adm/login');
734: $$helpdeskscript = <<"ENDSCRIPT";
735: <script type="text/javascript">
1.2 gci 736: // <![CDATA[
1.1 gci 737: function helpdesk() {
738: var codedom = document.client.udom.value;
739: if (codedom == '') {
740: codedom = "$authdomain";
741: }
742: var querystr = "origurl=$thisurl&codedom="+codedom;
743: document.location.href = "/adm/helpdesk?"+querystr;
744: return;
745: }
1.2 gci 746: // ]]>
1.1 gci 747: </script>
748: ENDSCRIPT
749: }
750: $contactblock .= <<"ENDBLOCK";
751: $version
752: ENDBLOCK
753: return $contactblock;
754: }
755:
756: sub forgotpwdisplay {
757: my (%lt) = @_;
758: my $prompt_for_resetpw = 1;
759: if ($prompt_for_resetpw) {
760: return '<br /> <a href="/adm/resetpw"><b>'.$lt{'forgotpw'}.'</b></a><br />';
761: }
762: return;
763: }
764:
765: sub loginhelpdisplay {
766: my (%lt) = @_;
767: my $login_help = 1;
768: if ($login_help) {
769: return ' <a href="/adm/loginproblems.html"><b>'.$lt{'help'}.'</b></a>';
770: }
771: return;
772: }
773:
774: sub coursecatalog_link {
775: my ($linkname,$fullgraph) = @_;
776: my $link = '/adm/coursecatalog';
777: if (!$fullgraph) {
778: $link.= '?interface=textual';
779: }
780: return ' <a href="/adm/coursecatalog"><b>'.$linkname.'</b></a><br />';
781: END
782: }
783:
784: sub newuser_link {
785: my ($linkname) = @_;
786: return ' <a href="/adm/createaccount"><b>'.$linkname.'</b></a><br />';
787: }
788:
789: 1;
790: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>