--- loncom/auth/lonlogin.pm 2008/12/15 11:44:46 1.113 +++ loncom/auth/lonlogin.pm 2010/08/22 21:51:11 1.139 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.113 2008/12/15 11:44:46 tempelho Exp $ +# $Id: lonlogin.pm,v 1.139 2010/08/22 21:51:11 raeburn 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 @@ -103,13 +110,20 @@ sub handler { $env{'form.interface'}=~s/\W//g; my $httpbrowser=$ENV{"HTTP_USER_AGENT"}; - - 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'}; @@ -117,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'); @@ -172,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 @@ -235,24 +258,18 @@ return OK; $servadm=~s/\,/\- - | -
- $loginform - | -
- $lt{'dom'}: + $lt{'dom'}: |
$domain
@@ -462,7 +481,7 @@ $r->print(<
- $lt{'serv'}:
+ $lt{'serv'}:
|
$lonhost ($role)
@@ -470,7 +489,7 @@ $r->print(< |
- $lt{'load'}:
+ $lt{'load'}:
|
$loadpercent $lt{'perc'}
@@ -478,30 +497,92 @@ $r->print(< |
- $lt{'userload'}:
+ $lt{'userload'}:
|
$userloadpercent $lt{'perc'}
|
+ $version
+ |
+ |