version 1.23, 2014/10/06 00:48:44
|
version 1.26, 2017/11/30 15:14:51
|
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 50 sub goto_login {
|
Line 53 sub goto_login {
|
} |
} |
|
|
|
|
sub sso_check { |
sub sso_lti_check { |
my ($data) = @_; |
my ($data) = @_; |
my %extra_env; |
my %extra_env; |
if (ref($data) eq 'HASH') { |
if (ref($data) eq 'HASH') { |
Line 61 sub sso_check {
|
Line 64 sub sso_check {
|
$extra_env{'request.sso.reloginserver'} = |
$extra_env{'request.sso.reloginserver'} = |
$data->{'sso.reloginserver'}; |
$data->{'sso.reloginserver'}; |
} |
} |
|
if ($data->{'lti.login'}) { |
|
$extra_env{'request.lti.login'} = $data->{'lti.login'}; |
|
} |
|
if ($data->{'lti.passbackid'}) { |
|
$extra_env{'request.lti.passbackid'} = $data->{'lti.passbackid'}; |
|
} |
|
if ($data->{'lti.passbackurl'}) { |
|
$extra_env{'request.lti.passbackurl'} = $data->{'lti.passbackurl'}; |
|
} |
|
if ($data->{'lti.rosterid'}) { |
|
$extra_env{'request.lti.rosterid'} = $data->{'lti.rosterid'}; |
|
} |
|
if ($data->{'lti.rosterurl'}) { |
|
$extra_env{'request.lti.rosterurl'} = $data->{'lti.rosterurl'}; |
|
} |
} |
} |
return \%extra_env; |
return \%extra_env; |
} |
} |
Line 173 sub ip_changed {
|
Line 191 sub ip_changed {
|
$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 210 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 245 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_lti_check(\%data); |
|
|
my %form; |
my %form; |
if ($data{'symb'} ne '') { |
if ($data{'symb'} ne '') { |
Line 239 sub handler {
|
Line 267 sub handler {
|
if ($data{'iptoken'} ne '') { |
if ($data{'iptoken'} ne '') { |
$form{'iptoken'} = $data{'iptoken'}; |
$form{'iptoken'} = $data{'iptoken'}; |
} |
} |
|
if ($data{'noloadbalance'} ne '') { |
|
$form{'noloadbalance'} = $data{'noloadbalance'}; |
|
} |
|
|
if (!$data{'role'}) { |
if (!$data{'role'}) { |
my $handle = &Apache::lonnet::check_for_valid_session($r); |
my $handle = &Apache::lonnet::check_for_valid_session($r); |