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