version 1.23, 2014/10/06 00:48:44
|
version 1.25.2.2, 2020/05/02 17:35:40
|
Line 37 use Apache::lonlocal;
|
Line 37 use Apache::lonlocal;
|
use Apache::lonlogin(); |
use Apache::lonlogin(); |
|
|
sub goto_login { |
sub goto_login { |
my ($r) = @_; |
my ($r,$domain) = @_; |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
my $url = '/adm/login'; |
|
if ($domain) { |
|
$url .= '?domain='.$domain; |
|
} |
$r->print(&Apache::loncommon::start_page('Going to login',undef, |
$r->print(&Apache::loncommon::start_page('Going to login',undef, |
{'redirect' => |
{'redirect' => [0,$url],}). |
[0,'/adm/login'],}). |
|
'<h1>'.&mt('One moment please...').'</h1>'. |
'<h1>'.&mt('One moment please...').'</h1>'. |
'<p>'.&mt('Transferring to login page.').'</p>'. |
'<p>'.&mt('Transferring to login page.').'</p>'. |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
Line 168 sub ip_changed {
|
Line 171 sub ip_changed {
|
} |
} |
} |
} |
} |
} |
|
unless ($hosthere) { |
|
if (($dataref->{'balancer'}) && ($dataref->{'balcookie'})) { |
|
&Apache::lonnet::delbalcookie($dataref->{'balcookie'},$dataref->{'balancer'}); |
|
} |
|
} |
} |
} |
if ($dataref->{'sso.login'}) { |
if ($dataref->{'sso.login'}) { |
$url .= '/adm/roles'; |
$url .= '/adm/roles'; |
} else { |
} else { |
$url .= '/adm/login'; |
$url .= '/adm/login'; |
|
if ($udom) { |
|
$url .= '?domain='.$udom; |
|
} |
$message .= '<br />'.&mt('You will need to provide your password one more time.'); |
$message .= '<br />'.&mt('You will need to provide your password one more time.'); |
} |
} |
my %info= ( |
my %info= ( |
'domain' => $dataref->{'domain'}, |
'domain' => $udom, |
'username' => $dataref->{'username'}, |
'username' => $dataref->{'username'}, |
'role' => $dataref->{'role'}, |
'role' => $dataref->{'role'}, |
'sessionserver' => $lonhost, |
'sessionserver' => $lonhost, |
Line 189 sub ip_changed {
|
Line 200 sub ip_changed {
|
} |
} |
my $iptoken = &Apache::lonnet::tmpput(\%info,$switchto); |
my $iptoken = &Apache::lonnet::tmpput(\%info,$switchto); |
unless ($iptoken eq 'conlost') { |
unless ($iptoken eq 'conlost') { |
$url .= '?iptoken='.$iptoken; |
$url .= ($url =~ /\?/) ? '&' : '?'; |
|
$url .= 'iptoken='.$iptoken; |
} |
} |
$r->print(&Apache::loncommon::start_page($title,undef, |
$r->print(&Apache::loncommon::start_page($title,undef, |
{'redirect' => |
{'redirect' => |
Line 223 sub handler {
|
Line 235 sub handler {
|
return &goto_login($r); |
return &goto_login($r); |
} |
} |
if ($data{'ip'} ne $ENV{'REMOTE_ADDR'}) { |
if ($data{'ip'} ne $ENV{'REMOTE_ADDR'}) { |
|
&Apache::lonnet::logthis('IP change when session migration requested -- was: '. |
|
$data{'ip'}.'; now: '.$ENV{'REMOTE_ADDR'}.' for '.$data{'username'}.':'.$data{'domain'}); |
return &ip_changed($r,$data{'domain'},$data{'server'},\%data); |
return &ip_changed($r,$data{'domain'},$data{'server'},\%data); |
} |
} |
|
|
&Apache::lonnet::logthis("Allowing access for $data{'username'}:$data{'domain'} to $data{'role'}"); |
&Apache::lonnet::logthis("Allowing access for $data{'username'}:$data{'domain'} to $data{'role'}"); |
my $home=&Apache::lonnet::homeserver($data{'username'},$data{'domain'}); |
my $home=&Apache::lonnet::homeserver($data{'username'},$data{'domain'}); |
if ($home =~ /(con_lost|no_such_host)/) { return &goto_login($r); } |
my $udom; |
|
if (&Apache::lonnet::domain($data{'domain'})) { |
|
$udom=$data{'domain'}; |
|
} |
|
if ($home =~ /(con_lost|no_such_host)/) { return &goto_login($r,$udom); } |
|
|
my $extra_env = &sso_check(\%data); |
my $extra_env = &sso_check(\%data); |
|
if (($data{'balancer'}) && ($data{'server'}) && ($data{'balcookie'})) { |
|
if (ref($extra_env) eq 'HASH') { |
|
$extra_env->{'request.balancercookie'} = $data{'server'}.':'.$data{'balcookie'}; |
|
} else { |
|
$extra_env = { 'request.balancercookie' => $data{'server'}.':'.$data{'balcookie'} }; |
|
} |
|
} |
|
|
my %form; |
my (%form,$cid); |
if ($data{'symb'} ne '') { |
if ($data{'symb'} ne '') { |
$form{'symb'} = $data{'symb'}; |
$form{'symb'} = $data{'symb'}; |
} |
} |
if ($data{'iptoken'} ne '') { |
if ($data{'iptoken'} ne '') { |
$form{'iptoken'} = $data{'iptoken'}; |
$form{'iptoken'} = $data{'iptoken'}; |
} |
} |
|
if ($data{'noloadbalance'} ne '') { |
if (!$data{'role'}) { |
$form{'noloadbalance'} = $data{'noloadbalance'}; |
|
} |
|
if ($data{'role'}) { |
|
if ($data{'role'} =~ m{\./($match_domain)/($match_courseid)(?:/\w+|$)}) { |
|
unless (&Apache::lonnet::homeserver($2,$1) eq 'no_host') { |
|
$cid = $1.'_'.$2; |
|
} |
|
} |
|
} else { |
my $handle = &Apache::lonnet::check_for_valid_session($r); |
my $handle = &Apache::lonnet::check_for_valid_session($r); |
if ($handle) { |
if ($handle) { |
&Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), |
&Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'), |
Line 270 sub handler {
|
Line 303 sub handler {
|
$next_url .= '&orgurl='.&escape($data{'origurl'}); |
$next_url .= '&orgurl='.&escape($data{'origurl'}); |
} |
} |
&Apache::lonauth::success($r,$data{'username'},$data{'domain'},$home, |
&Apache::lonauth::success($r,$data{'username'},$data{'domain'},$home, |
$next_url,$extra_env,\%form); |
$next_url,$extra_env,\%form,$cid); |
return OK; |
return OK; |
} |
} |
|
|