--- loncom/auth/lonlogin.pm 2010/03/03 17:05:49 1.134 +++ loncom/auth/lonlogin.pm 2010/08/25 22:03:51 1.142 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.134 2010/03/03 17:05:49 raeburn Exp $ +# $Id: lonlogin.pm,v 1.142 2010/08/25 22:03:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -69,39 +69,35 @@ sub handler { return OK; } + $env{'form.firsturl'} =~ =~ s/(`)/'/g; # -------------------------------- Prevent users from attempting to login twice my $handle = &Apache::lonnet::check_for_valid_session($r); - if ($handle=~/^publicuser\_/) { + if ($handle ne '') { + my $lonidsdir=$r->dir_config('lonIDsDir'); + if ($handle=~/^publicuser\_/) { # For "public user" - remove it, we apparently really want to login - unlink($r->dir_config('lonIDsDir')."/$handle.id"); - } elsif ($handle ne '') { + unlink($r->dir_config('lonIDsDir')."/$handle.id"); + } else { # Indeed, a valid token is found - my $start_page = - &Apache::loncommon::start_page('Already logged in'); - my $end_page = - &Apache::loncommon::end_page(); - my $dest = '/adm/roles'; - if ($env{'form.firsturl'} ne '') { - $dest = $env{'form.firsturl'}; - } - - my $dom = &Apache::lonnet::default_login_domain(); - my %helpconfig = &Apache::lonnet::get_dom('configuration',['helpsettings'],$dom); - - my $loginhelp_page = $helpconfig{'helpsettings'}{'loginhelpurl'}; - if ($loginhelp_page eq '') { - $loginhelp_page = '/adm/loginproblems.html'; - } - $r->print( + &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle); + my $start_page = + &Apache::loncommon::start_page('Already logged in'); + my $end_page = + &Apache::loncommon::end_page(); + my $dest = '/adm/roles'; + if ($env{'form.firsturl'} ne '') { + $dest = $env{'form.firsturl'}; + } + $r->print( $start_page .'

'.&mt('You are already logged in!').'

' .'

'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].', '','','','').'

' - .'

'.&mt('Login problems?').'

' - .$dom.' '.$end_page + .$end_page ); - return OK; + return OK; + } } # ---------------------------------------------------- No valid token, continue @@ -157,15 +153,8 @@ sub handler { my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim); my $userloadpercent=&Apache::lonnet::userload(); -# ------------------------------------------------------- Do the load balancing - my $otherserver= &Apache::lonnet::absolute_url($host_name); my $firsturl= ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'}); -# ---------------------------------------------------------- Are we overloaded? - if ((($userloadpercent>100.0)||($loadpercent>100.0))) { - my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent); - if ($unloaded) { $otherserver=$unloaded; } - } # ----------------------------------------------------------- Get announcements my $announcements=&Apache::lonnet::getannounce(); @@ -269,13 +258,12 @@ my $link=&Apache::loncommon::designparm( my $vlink=&Apache::loncommon::designparm('login.vlink',$domain); my $alink=&Apache::loncommon::designparm('login.alink',$domain); my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain); +my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain); +my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain); +my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain); my $logo=&Apache::loncommon::designparm('login.logo',$domain); my $img=&Apache::loncommon::designparm('login.img',$domain); -my $domainlogo='
'.&Apache::loncommon::domainlogo($domain).'
'; -my $login=&Apache::loncommon::designparm('login.login',$domain); -if ($login eq '') { -$login = $iconpath.'/'.&mt('userauthentication.gif'); -} +my $domainlogo=&Apache::loncommon::domainlogo($domain); my $showbanner = 1; my $showmainlogo = 1; if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) { @@ -287,7 +275,6 @@ if (defined(&Apache::loncommon::designpa my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain); my $showcoursecat = &Apache::loncommon::designparm('login.coursecatalog',$domain); -my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain); my $shownewuserlink = &Apache::loncommon::designparm('login.newuser',$domain); my $now=time; @@ -320,6 +307,14 @@ this.document.client.elements.upass$now. this.document.server.submit(); return false; } + +function enableInput() { + this.document.client.elements.upass$now.removeAttribute("readonly"); + this.document.client.elements.uname.removeAttribute("readonly"); + this.document.client.elements.udom.removeAttribute("readonly"); + return; +} + // ]]> @@ -332,7 +327,8 @@ my %add_entries = ( text => "$font", link => "$link", vlink => "$vlink", - alink => "$alink",); + alink => "$alink", + onload => 'javascript:enableInput();',); $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js, { 'redirect' => [$expire,'/adm/roles'], @@ -361,7 +357,7 @@ my %lt=&Apache::lonlocal::texthash( my $forgotpw = &forgotpwdisplay(%lt); $forgotpw .= '
' if $forgotpw; -my $loginhelp = &loginhelpdisplay(%lt); +my $loginhelp = &loginhelpdisplay($authdomain,%lt); $loginhelp .= '
' if $loginhelp; # ---------------------------------------------------- Serve out DES JavaScript @@ -372,7 +368,9 @@ $r->print(<$jsh>); # ---------------------------------------------------------- Serve rest of page $r->print( - '
'); + '
' +); # # If the loadbalancing yielded just http:// because perhaps there's no loadbalancing? @@ -380,7 +378,7 @@ $r->print( # $r->print(< +
@@ -400,13 +398,12 @@ my $newuserlink; if ($shownewuserlink) { $newuserlink = &newuser_link($lt{'newuser'}).'
'; } -my $logintitle; -if ($loginheader eq 'text') { - $logintitle ='

'.$lt{'log'}.'

'; -} else { - $logintitle = ''.
-                  &mt('User Authentication').''; -} +my $logintitle = + '

' + .$lt{'log'} + .'

'; my $noscript_warning='
-
-
+
+
$logintitle - - - - -
- $loginform -
- $noscript_warning + $loginform + $noscript_warning
-
+
$loginhelp $forgotpw $contactblock @@ -460,17 +450,20 @@ HEADER $coursecatalog
+ +
ENDTOP if ($showmainlogo) { $r->print(' '."\n"); } $r->print(< 
+
+
ENDTOP $r->print(<
@@ -510,6 +503,11 @@ $r->print(<
+
+
+ $domainlogo +
+