1: # The LearningOnline Network
2: # Login Screen
3: #
4: # $Id: lonlogin.pm,v 1.150 2012/04/11 11:40:07 goltermann Exp $
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;
41:
42: sub handler {
43: my $r = shift;
44:
45: &Apache::loncommon::get_unprocessed_cgi
46: (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'},
47: $ENV{'REDIRECT_QUERY_STRING'}),
48: ['interface','username','domain','firsturl','localpath','localres',
49: 'token','role','symb']);
50: if (!defined($env{'form.firsturl'})) {
51: &Apache::lonacc::get_posted_cgi($r,['firsturl']);
52: }
53:
54: # -- check if they are a migrating user
55: if (defined($env{'form.token'})) {
56: return &Apache::migrateuser::handler($r);
57: }
58:
59: &Apache::loncommon::no_cache($r);
60: &Apache::lonlocal::get_language_handle($r);
61: &Apache::loncommon::content_type($r,'text/html');
62: $r->send_http_header;
63: return OK if $r->header_only;
64:
65:
66: # Are we re-routing?
67: my $londocroot = $r->dir_config('lonDocRoot');
68: if (-e "$londocroot/lon-status/reroute.txt") {
69: &Apache::lonauth::reroute($r);
70: return OK;
71: }
72:
73: $env{'form.firsturl'} =~ s/(`)/'/g;
74:
75: # -------------------------------- Prevent users from attempting to login twice
76: my $handle = &Apache::lonnet::check_for_valid_session($r);
77: if ($handle ne '') {
78: my $lonidsdir=$r->dir_config('lonIDsDir');
79: if ($handle=~/^publicuser\_/) {
80: # For "public user" - remove it, we apparently really want to login
81: unlink($r->dir_config('lonIDsDir')."/$handle.id");
82: } else {
83: # Indeed, a valid token is found
84: &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
85: my $start_page =
86: &Apache::loncommon::start_page('Already logged in');
87: my $end_page =
88: &Apache::loncommon::end_page();
89: my $dest = '/adm/roles';
90: if ($env{'form.firsturl'} ne '') {
91: $dest = $env{'form.firsturl'};
92: }
93: $r->print(
94: $start_page
95: .'<p class="LC_warning">'.&mt('You are already logged in!').'</p>'
96: .'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].',
97: '<a href="'.$dest.'">','</a>','<a href="/adm/logout">','</a>').'</p>'
98: .$end_page
99: );
100: return OK;
101: }
102: }
103:
104: # ---------------------------------------------------- No valid token, continue
105:
106: # ---------------------------- Not possible to really login to domain "public"
107: if ($env{'form.domain'} eq 'public') {
108: $env{'form.domain'}='';
109: $env{'form.username'}='';
110: }
111: # ----------------------------------------------------------- Process Interface
112: $env{'form.interface'}=~s/\W//g;
113:
114: my $httpbrowser=$ENV{"HTTP_USER_AGENT"};
115:
116: my $iconpath=
117: &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
118:
119: my $lonhost = $r->dir_config('lonHostID');
120: my $domain = &Apache::lonnet::default_login_domain();
121: if ($lonhost ne '') {
122: my $redirect = &check_loginvia($domain,$lonhost);
123: if ($redirect) {
124: $r->print($redirect);
125: return OK;
126: }
127: }
128:
129: if (($env{'form.domain'}) &&
130: (&Apache::lonnet::domain($env{'form.domain'},'description'))) {
131: $domain=$env{'form.domain'};
132: }
133: my $role = $r->dir_config('lonRole');
134: my $loadlim = $r->dir_config('lonLoadLim');
135: my $uloadlim= $r->dir_config('lonUserLoadLim');
136: my $servadm = $r->dir_config('lonAdmEMail');
137: my $tabdir = $r->dir_config('lonTabDir');
138: my $include = $r->dir_config('lonIncludes');
139: my $expire = $r->dir_config('lonExpire');
140: my $version = $r->dir_config('lonVersion');
141: my $host_name = &Apache::lonnet::hostname($lonhost);
142:
143: # --------------------------------------------- Default values for login fields
144:
145: my $authusername=($env{'form.username'}?$env{'form.username'}:'');
146: my $authdomain=($env{'form.domain'}?$env{'form.domain'}:$domain);
147:
148: # ---------------------------------------------------------- Determine own load
149: my $loadavg;
150: {
151: my $loadfile=Apache::File->new('/proc/loadavg');
152: $loadavg=<$loadfile>;
153: }
154: $loadavg =~ s/\s.*//g;
155:
156: my ($loadpercent,$userloadpercent);
157: if ($loadlim) {
158: $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim);
159: }
160: if ($uloadlim) {
161: $userloadpercent=&Apache::lonnet::userload();
162: }
163:
164: my $firsturl=
165: ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'});
166:
167: # ----------------------------------------------------------- Get announcements
168: my $announcements=&Apache::lonnet::getannounce();
169: # -------------------------------------------------------- Set login parameters
170:
171: my @hexstr=('0','1','2','3','4','5','6','7',
172: '8','9','a','b','c','d','e','f');
173: my $lkey='';
174: for (0..7) {
175: $lkey.=$hexstr[rand(15)];
176: }
177:
178: my $ukey='';
179: for (0..7) {
180: $ukey.=$hexstr[rand(15)];
181: }
182:
183: my $lextkey=hex($lkey);
184: if ($lextkey>2147483647) { $lextkey-=4294967296; }
185:
186: my $uextkey=hex($ukey);
187: if ($uextkey>2147483647) { $uextkey-=4294967296; }
188:
189: # -------------------------------------------------------- Store away log token
190: my $tokenextras;
191: if ($env{'form.role'}) {
192: $tokenextras = '&role='.&escape($env{'form.role'});
193: }
194: if ($env{'form.symb'}) {
195: if (!$tokenextras) {
196: $tokenextras = '&';
197: }
198: $tokenextras .= '&symb='.&escape($env{'form.symb'});
199: }
200: my $logtoken=Apache::lonnet::reply(
201: 'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras,
202: $lonhost);
203:
204: # -- If we cannot talk to ourselves, or hostID does not map to a hostname
205: # we are in serious trouble
206:
207: if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) {
208: if ($logtoken eq 'no_such_host') {
209: &Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab');
210: }
211: my $spares='';
212: my $last;
213: foreach my $hostid (sort
214: {
215: &Apache::lonnet::hostname($a) cmp
216: &Apache::lonnet::hostname($b);
217: }
218: keys(%Apache::lonnet::spareid)) {
219: next if ($hostid eq $lonhost);
220: my $hostname = &Apache::lonnet::hostname($hostid);
221: next if (($last eq $hostname) || ($hostname eq ''));
222: $spares.='<br /><font size="+1"><a href="http://'.
223: $hostname.
224: '/adm/login?domain='.$authdomain.'">'.
225: $hostname.'</a>'.
226: ' '.&mt('(preferred)').'</font>'.$/;
227: $last=$hostname;
228: }
229: if ($spares) {
230: $spares.= '<br />';
231: }
232: my %all_hostnames = &Apache::lonnet::all_hostnames();
233: foreach my $hostid (sort
234: {
235: &Apache::lonnet::hostname($a) cmp
236: &Apache::lonnet::hostname($b);
237: }
238: keys(%all_hostnames)) {
239: next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
240: my $hostname = &Apache::lonnet::hostname($hostid);
241: next if (($last eq $hostname) || ($hostname eq ''));
242: $spares.='<br /><a href="http://'.
243: $hostname.
244: '/adm/login?domain='.$authdomain.'">'.
245: $hostname.'</a>';
246: $last=$hostname;
247: }
248: $r->print(
249: '<html>'
250: .'<head><title>'
251: .&mt('The LearningOnline Network with CAPA')
252: .'</title></head>'
253: .'<body bgcolor="#FFFFFF">'
254: .'<h1>'.&mt('The LearningOnline Network with CAPA').'</h1>'
255: .'<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />'
256: .'<h3>'.&mt('This LON-CAPA server is temporarily not available for login.').'</h3>');
257: if ($spares) {
258: $r->print('<p>'.&mt('Please attempt to login to one of the following servers:')
259: .'</p>'
260: .$spares);
261: }
262: $r->print('</body>'
263: .'</html>'
264: );
265: return OK;
266: }
267:
268: # ----------------------------------------------- Apparently we are in business
269: $servadm=~s/\,/\<br \/\>/g;
270:
271: # ----------------------------------------------------------- Front page design
272: my $pgbg=&Apache::loncommon::designparm('login.pgbg',$domain);
273: my $font=&Apache::loncommon::designparm('login.font',$domain);
274: my $link=&Apache::loncommon::designparm('login.link',$domain);
275: my $vlink=&Apache::loncommon::designparm('login.vlink',$domain);
276: my $alink=&Apache::loncommon::designparm('login.alink',$domain);
277: my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain);
278: my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain);
279: my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain);
280: my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain);
281: my $logo=&Apache::loncommon::designparm('login.logo',$domain);
282: my $img=&Apache::loncommon::designparm('login.img',$domain);
283: my $domainlogo=&Apache::loncommon::domainlogo($domain);
284: my $showbanner = 1;
285: my $showmainlogo = 1;
286: if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) {
287: $showbanner = &Apache::loncommon::designparm('login.showlogo_img',$domain);
288: }
289: if (defined(&Apache::loncommon::designparm('login.showlogo_logo',$domain))) {
290: $showmainlogo = &Apache::loncommon::designparm('login.showlogo_logo',$domain);
291: }
292: my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain);
293: my $showcoursecat =
294: &Apache::loncommon::designparm('login.coursecatalog',$domain);
295: my $shownewuserlink =
296: &Apache::loncommon::designparm('login.newuser',$domain);
297: my $now=time;
298: my $js = (<<ENDSCRIPT);
299:
300: <script type="text/javascript" language="JavaScript">
301: // <![CDATA[
302: function send()
303: {
304: this.document.server.elements.uname.value
305: =this.document.client.elements.uname.value;
306:
307: this.document.server.elements.udom.value
308: =this.document.client.elements.udom.value;
309:
310: uextkey=this.document.client.elements.uextkey.value;
311: lextkey=this.document.client.elements.lextkey.value;
312: initkeys();
313:
314: this.document.server.elements.upass0.value
315: =crypted(this.document.client.elements.upass$now.value.substr(0,15));
316: this.document.server.elements.upass1.value
317: =crypted(this.document.client.elements.upass$now.value.substr(15,15));
318: this.document.server.elements.upass2.value
319: =crypted(this.document.client.elements.upass$now.value.substr(30,15));
320:
321: this.document.client.elements.uname.value='';
322: this.document.client.elements.upass$now.value='';
323:
324: this.document.server.submit();
325: return false;
326: }
327:
328: function enableInput() {
329: this.document.client.elements.upass$now.removeAttribute("readOnly");
330: this.document.client.elements.uname.removeAttribute("readOnly");
331: this.document.client.elements.udom.removeAttribute("readOnly");
332: return;
333: }
334:
335: // ]]>
336: </script>
337:
338: ENDSCRIPT
339:
340: # --------------------------------------------------- Print login screen header
341:
342: my %add_entries = (
343: bgcolor => "$mainbg",
344: text => "$font",
345: link => "$link",
346: vlink => "$vlink",
347: alink => "$alink",
348: onload => 'javascript:enableInput();',);
349:
350: $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js,
351: { 'redirect' => [$expire,'/adm/roles'],
352: 'add_entries' => \%add_entries,
353: 'only_body' => 1,}));
354:
355: # ----------------------------------------------------------------------- Texts
356:
357: my %lt=&Apache::lonlocal::texthash(
358: 'un' => 'Username',
359: 'pw' => 'Password',
360: 'dom' => 'Domain',
361: 'perc' => 'percent',
362: 'load' => 'Server Load',
363: 'userload' => 'User Load',
364: 'catalog' => 'Course/Community Catalog',
365: 'log' => 'Log in',
366: 'help' => 'Log-in Help',
367: 'serv' => 'Server',
368: 'servadm' => 'Server Administration',
369: 'helpdesk' => 'Contact Helpdesk',
370: 'forgotpw' => 'Forgot password?',
371: 'newuser' => 'New User?',
372: );
373: # -------------------------------------------------- Change password field name
374:
375: my $forgotpw = &forgotpwdisplay(%lt);
376: $forgotpw .= '<br />' if $forgotpw;
377: my $loginhelp = &loginhelpdisplay($authdomain,%lt);
378: $loginhelp .= '<br />' if $loginhelp;
379:
380: # ---------------------------------------------------- Serve out DES JavaScript
381: {
382: my $jsh=Apache::File->new($include."/londes.js");
383: $r->print(<$jsh>);
384: }
385: # ---------------------------------------------------------- Serve rest of page
386:
387: $r->print(
388: '<div class="LC_Box"'
389: .' style="margin:0 auto; padding:10px; width:90%; height: auto; background-color:#FFFFFF;">'
390: );
391:
392: #
393: # If the loadbalancing yielded just http:// because perhaps there's no loadbalancing?
394: # then just us a relative link to authenticate:
395: #
396:
397: $r->print(<<ENDSERVERFORM);
398: <form name="server" action="/adm/authenticate" method="post" target="_top">
399: <input type="hidden" name="logtoken" value="$logtoken" />
400: <input type="hidden" name="serverid" value="$lonhost" />
401: <input type="hidden" name="uname" value="" />
402: <input type="hidden" name="upass0" value="" />
403: <input type="hidden" name="upass1" value="" />
404: <input type="hidden" name="upass2" value="" />
405: <input type="hidden" name="udom" value="" />
406: <input type="hidden" name="localpath" value="$env{'form.localpath'}" />
407: <input type="hidden" name="localres" value="$env{'form.localres'}" />
408: </form>
409: ENDSERVERFORM
410: my $coursecatalog;
411: if (($showcoursecat eq '') || ($showcoursecat)) {
412: $coursecatalog = &coursecatalog_link($lt{'catalog'}).'<br />';
413: }
414: my $newuserlink;
415: if ($shownewuserlink) {
416: $newuserlink = &newuser_link($lt{'newuser'}).'<br />';
417: }
418: my $logintitle =
419: '<h2 class="LC_hcell"'
420: .' style="background:'.$loginbox_header_bgcol.';'
421: .' color:'.$loginbox_header_textcol.'">'
422: .$lt{'log'}
423: .'</h2>';
424:
425: my $noscript_warning='<noscript><span class="LC_warning"><b>'
426: .&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.')
427: .'</b></span></noscript>';
428: my $helpdeskscript;
429: my $contactblock = &contactdisplay(\%lt,$servadm,$showadminmail,
430: $authdomain,\$helpdeskscript);
431:
432: my $loginform=(<<LFORM);
433: <form name="client" action="" onsubmit="return(send())">
434: <input type="hidden" name="lextkey" value="$lextkey" />
435: <input type="hidden" name="uextkey" value="$uextkey" />
436: <b><label for="uname">$lt{'un'}</label>:</b><br />
437: <input type="text" name="uname" id="uname" size="15" value="$authusername" readonly="readonly" /><br />
438: <b><label for="upass$now">$lt{'pw'}</label>:</b><br />
439: <input type="password" name="upass$now" id="upass$now" size="15" readonly="readonly" /><br />
440: <b><label for="udom">$lt{'dom'}</label>:</b><br />
441: <input type="text" name="udom" id="udom" size="15" value="$authdomain" readonly="readonly" /><br />
442: <input type="submit" value="$lt{'log'}" />
443: </form>
444: LFORM
445:
446: if ($showbanner) {
447: $r->print(<<HEADER);
448: <!-- The LON-CAPA Header -->
449: <div style="background:$pgbg;margin:0;width:100%;">
450: <img src="$img" border="0" alt="The Learning Online Network with CAPA" />
451: </div>
452: HEADER
453: }
454: $r->print(<<ENDTOP);
455: <div style="float:left;margin-top:0;">
456: <div class="LC_Box" style="background:$loginbox_bg;">
457: $logintitle
458: $loginform
459: $noscript_warning
460: </div>
461:
462: <div class="LC_Box" style="padding-top: 10px;">
463: $loginhelp
464: $forgotpw
465: $contactblock
466: $newuserlink
467: $coursecatalog
468: </div>
469: </div>
470:
471: <div>
472: ENDTOP
473: if ($showmainlogo) {
474: $r->print(' <img src="'.$logo.'" alt="" />'."\n");
475: }
476: $r->print(<<ENDTOP);
477: $announcements
478: </div>
479: <hr style="clear:both;" />
480: ENDTOP
481: my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow);
482: $domainrow = <<"END";
483: <tr>
484: <td align="left" valign="top">
485: <small><b>$lt{'dom'}: </b></small>
486: </td>
487: <td align="left" valign="top">
488: <small><tt> $domain</tt></small>
489: </td>
490: </tr>
491: END
492: $serverrow = <<"END";
493: <tr>
494: <td align="left" valign="top">
495: <small><b>$lt{'serv'}: </b></small>
496: </td>
497: <td align="left" valign="top">
498: <small><tt> $lonhost ($role)</tt></small>
499: </td>
500: </tr>
501: END
502: if ($loadlim) {
503: $loadrow = <<"END";
504: <tr>
505: <td align="left" valign="top">
506: <small><b>$lt{'load'}: </b></small>
507: </td>
508: <td align="left" valign="top">
509: <small><tt> $loadpercent $lt{'perc'}</tt></small>
510: </td>
511: </tr>
512: END
513: }
514: if ($uloadlim) {
515: $userloadrow = <<"END";
516: <tr>
517: <td align="left" valign="top">
518: <small><b>$lt{'userload'}: </b></small>
519: </td>
520: <td align="left" valign="top">
521: <small><tt> $userloadpercent $lt{'perc'}</tt></small>
522: </td>
523: </tr>
524: END
525: }
526: if (($version ne '') && ($version ne '<!-- VERSION -->')) {
527: $versionrow = <<"END";
528: <tr>
529: <td colspan="2" align="left">
530: <small>$version</small>
531: </td>
532: </tr>
533: END
534: }
535:
536: $r->print(<<ENDDOCUMENT);
537: <div style="float: left;">
538: <table border="0" cellspacing="0" cellpadding="0">
539: $domainrow
540: $serverrow
541: $loadrow
542: $userloadrow
543: $versionrow
544: </table>
545: </div>
546: <div style="float: right;">
547: $domainlogo
548: </div>
549: <br style="clear:both;" />
550: </div>
551:
552: <script type="text/javascript">
553: // <![CDATA[
554: // the if prevents the script error if the browser can not handle this
555: if ( document.client.uname ) { document.client.uname.focus(); }
556: // ]]>
557: </script>
558: $helpdeskscript
559:
560: ENDDOCUMENT
561: my %endargs = ( 'noredirectlink' => 1, );
562: $r->print(&Apache::loncommon::end_page(\%endargs));
563: return OK;
564: }
565:
566: sub check_loginvia {
567: my ($domain,$lonhost) = @_;
568: if ($domain eq '' || $lonhost eq '') {
569: return;
570: }
571: my %domconfhash = &Apache::loncommon::get_domainconf($domain);
572: my $loginvia = $domconfhash{$domain.'.login.loginvia_'.$lonhost};
573: my $loginvia_exempt = $domconfhash{$domain.'.login.loginvia_exempt_'.$lonhost};
574: my $output;
575: if ($loginvia ne '') {
576: my $noredirect;
577: my $ip = $ENV{'REMOTE_ADDR'};
578: if ($ip eq '127.0.0.1') {
579: $noredirect = 1;
580: } else {
581: if ($loginvia_exempt ne '') {
582: my @exempt = split(',',$loginvia_exempt);
583: if (grep(/^\Q$ip\E$/,@exempt)) {
584: $noredirect = 1;
585: }
586: }
587: }
588: unless ($noredirect) {
589: my ($newhost,$path);
590: if ($loginvia =~ /:/) {
591: ($newhost,$path) = split(':',$loginvia);
592: } else {
593: $newhost = $loginvia;
594: }
595: if ($newhost ne $lonhost) {
596: if (&Apache::lonnet::hostname($newhost) ne '') {
597: $output = &redirect_page($newhost,$path);
598: }
599: }
600: }
601: }
602: return $output;
603: }
604:
605: sub redirect_page {
606: my ($desthost,$path) = @_;
607: my $protocol = $Apache::lonnet::protocol{$desthost};
608: $protocol = 'http' if ($protocol ne 'https');
609: unless ($path =~ m{^/}) {
610: $path = '/'.$path;
611: }
612: my $url = $protocol.'://'.&Apache::lonnet::hostname($desthost).$path;
613: if ($env{'form.firsturl'} ne '') {
614: $url .='?firsturl='.$env{'form.firsturl'};
615: }
616: my $start_page = &Apache::loncommon::start_page('Switching Server ...',undef,
617: {'redirect' => [0,$url],});
618: my $end_page = &Apache::loncommon::end_page();
619: return $start_page.$end_page;
620: }
621:
622: sub contactdisplay {
623: my ($lt,$servadm,$showadminmail,$authdomain,$helpdeskscript) = @_;
624: my $contactblock;
625: my $showhelpdesk = 0;
626: my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
627: if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) {
628: $showhelpdesk = 1;
629: }
630: if ($servadm && $showadminmail) {
631: $contactblock .= $$lt{'servadm'}.':<br />'.
632: '<tt>'.$servadm.'</tt><br />';
633: }
634: if ($showhelpdesk) {
635: $contactblock .= '<a href="javascript:helpdesk()">'.$lt->{'helpdesk'}.'</a><br />';
636: my $thisurl = &escape('/adm/login');
637: $$helpdeskscript = <<"ENDSCRIPT";
638: <script type="text/javascript">
639: // <![CDATA[
640: function helpdesk() {
641: var codedom = document.client.udom.value;
642: if (codedom == '') {
643: codedom = "$authdomain";
644: }
645: var querystr = "origurl=$thisurl&codedom="+codedom;
646: document.location.href = "/adm/helpdesk?"+querystr;
647: return;
648: }
649: // ]]>
650: </script>
651: ENDSCRIPT
652: }
653: return $contactblock;
654: }
655:
656: sub forgotpwdisplay {
657: my (%lt) = @_;
658: my $prompt_for_resetpw = 1;
659: if ($prompt_for_resetpw) {
660: return '<a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a>';
661: }
662: return;
663: }
664:
665: sub loginhelpdisplay {
666: my ($authdomain,%lt) = @_;
667: my $login_help = 1;
668: if ($login_help) {
669: my $dom = $authdomain;
670: if ($dom eq '') {
671: $dom = &Apache::lonnet::default_login_domain();
672: }
673: my %helpconfig = &Apache::lonnet::get_dom('configuration',['helpsettings'],$dom);
674: my $loginhelp_url = $helpconfig{'helpsettings'}{'loginhelpurl'};
675: if ($loginhelp_url ne '') {
676: return '<a href="'.$loginhelp_url.'">'.$lt{'help'}.'</a>';
677: } else {
678: return '<a href="/adm/loginproblems.html">'.$lt{'help'}.'</a>';
679: }
680: }
681: return;
682: }
683:
684: sub coursecatalog_link {
685: my ($linkname) = @_;
686: return <<"END";
687: <a href="/adm/coursecatalog">$linkname</a>
688: END
689: }
690:
691: sub newuser_link {
692: my ($linkname) = @_;
693: return '<a href="/adm/createaccount">'.$linkname.'</a>';
694: }
695:
696: 1;
697: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>