--- loncom/auth/lonlogin.pm 2008/12/03 13:07:15 1.110 +++ loncom/auth/lonlogin.pm 2010/05/21 15:54:34 1.138 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.110 2008/12/03 13:07:15 muellerd Exp $ +# $Id: lonlogin.pm,v 1.138 2010/05/21 15:54:34 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -46,7 +46,7 @@ sub handler { (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'}, $ENV{'REDIRECT_QUERY_STRING'}), ['interface','username','domain','firsturl','localpath','localres', - 'token']); + 'token','role','symb']); if (!defined($env{'form.firsturl'})) { &Apache::lonacc::get_posted_cgi($r,['firsturl']); } @@ -72,24 +72,31 @@ sub handler { # -------------------------------- 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(); - $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('Please either [_1]continue the current session[_2] or [_3]logout[_4].', - '','','','').'
' - .'' + .''.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].', + '','','','').'
' .$end_page ); - return OK; + return OK; + } } # ---------------------------------------------------- No valid token, continue @@ -102,21 +109,21 @@ sub handler { # ----------------------------------------------------------- Process Interface $env{'form.interface'}=~s/\W//g; - # my $textbrowsers=$r->dir_config('lonTextBrowsers'); my $httpbrowser=$ENV{"HTTP_USER_AGENT"}; - - # foreach (split(/\:/,$textbrowsers)) { -# if ($httpbrowser=~/$_/i) { -# $env{'form.interface'}='textual'; -# } -# } - - my $fullgraph=($env{'form.interface'} ne 'textual'); my $iconpath= &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL')); + my $lonhost = $r->dir_config('lonHostID'); my $domain = &Apache::lonnet::default_login_domain(); + if ($lonhost ne '') { + my $redirect = &check_loginvia($domain,$lonhost); + if ($redirect) { + $r->print($redirect); + return OK; + } + } + if (($env{'form.domain'}) && (&Apache::lonnet::domain($env{'form.domain'},'description'))) { $domain=$env{'form.domain'}; @@ -124,7 +131,6 @@ sub handler { my $role = $r->dir_config('lonRole'); my $loadlim = $r->dir_config('lonLoadLim'); my $servadm = $r->dir_config('lonAdmEMail'); - my $lonhost = $r->dir_config('lonHostID'); my $tabdir = $r->dir_config('lonTabDir'); my $include = $r->dir_config('lonIncludes'); my $expire = $r->dir_config('lonExpire'); @@ -179,8 +185,18 @@ sub handler { if ($uextkey>2147483647) { $uextkey-=4294967296; } # -------------------------------------------------------- Store away log token + my $tokenextras; + if ($env{'form.role'}) { + $tokenextras = '&role='.&escape($env{'form.role'}); + } + if ($env{'form.symb'}) { + if (!$tokenextras) { + $tokenextras = '&'; + } + $tokenextras .= '&symb='.&escape($env{'form.symb'}); + } my $logtoken=Apache::lonnet::reply( - 'tmpput:'.$ukey.$lkey.'&'.$firsturl, + 'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras, $lonhost); # ------------------- If we cannot talk to ourselves, we are in serious trouble @@ -242,28 +258,18 @@ return OK; $servadm=~s/\,/\- - | -
- $lt{'dom'}: + $lt{'dom'}: |
$domain
@@ -483,7 +472,7 @@ $r->print(<
- $lt{'serv'}:
+ $lt{'serv'}:
|
$lonhost ($role)
@@ -491,7 +480,7 @@ $r->print(< |
- $lt{'load'}:
+ $lt{'load'}:
|
$loadpercent $lt{'perc'}
@@ -499,33 +488,92 @@ $r->print(< |
- $lt{'userload'}:
+ $lt{'userload'}:
|
$userloadpercent $lt{'perc'}
|
+ $version
+ |
+ |