version 1.49, 2020/12/18 15:23:03
|
version 1.50, 2021/05/04 18:47:37
|
Line 30 package Apache::migrateuser;
|
Line 30 package Apache::migrateuser;
|
|
|
use strict; |
use strict; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use Apache::Constants qw(:common :http :methods); |
use Apache::Constants qw(:common :http :methods :remotehost); |
use Apache::lonauth; |
use Apache::lonauth; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon; |
use Apache::loncommon; |
Line 253 sub ip_changed {
|
Line 253 sub ip_changed {
|
if ($hostname) { |
if ($hostname) { |
my $protocol = $Apache::lonnet::protocol{$switchto}; |
my $protocol = $Apache::lonnet::protocol{$switchto}; |
$protocol = 'http' if ($protocol ne 'https'); |
$protocol = 'http' if ($protocol ne 'https'); |
|
my $alias = &Apache::lonnet::use_proxy_alias($r,$switchto); |
|
$hostname = $alias if ($alias ne ''); |
$url = $protocol.'://'.$hostname; |
$url = $protocol.'://'.$hostname; |
if ($rule_in_effect eq 'balancer') { |
if ($rule_in_effect eq 'balancer') { |
$message .= '<br />'. |
$message .= '<br />'. |
Line 308 sub ip_changed {
|
Line 310 sub ip_changed {
|
} |
} |
|
|
sub logout { |
sub logout { |
my ($r,$handle,$data,$lti_env) = @_; |
my ($r,$ip,$handle,$data,$lti_env) = @_; |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
if (unlink("$lonidsdir/$handle.id")) { |
if (unlink("$lonidsdir/$handle.id")) { |
if (($env{'user.linkedenv'} =~ /^[a-f0-9]+_linked$/) && |
if (($env{'user.linkedenv'} =~ /^[a-f0-9]+_linked$/) && |
Line 319 sub logout {
|
Line 321 sub logout {
|
} |
} |
my %temp=('logout' => time); |
my %temp=('logout' => time); |
&Apache::lonnet::put('email_status',\%temp); |
&Apache::lonnet::put('email_status',\%temp); |
my $ip = &Apache::lonnet::get_requestor_ip(); |
|
&Apache::lonnet::log($env{'user.domain'}, |
&Apache::lonnet::log($env{'user.domain'}, |
$env{'user.name'}, |
$env{'user.name'}, |
$env{'user.home'}, |
$env{'user.home'}, |
Line 588 sub handler {
|
Line 589 sub handler {
|
} |
} |
my ($home,@ids); |
my ($home,@ids); |
@ids=&Apache::lonnet::current_machine_ids(); |
@ids=&Apache::lonnet::current_machine_ids(); |
my $ip = &Apache::lonnet::get_requestor_ip(); |
my $ip = &Apache::lonnet::get_requestor_ip($r,REMOTE_NOLOOKUP); |
if ($data{'ip'} ne $ip) { |
if ($data{'ip'} ne $ip) { |
&Apache::lonnet::logthis('IP change when session migration requested -- was: '. |
&Apache::lonnet::logthis('IP change when session migration requested -- was: '. |
$data{'ip'}.'; now: '.$ip.' for '.$data{'username'}.':'.$data{'domain'}); |
$data{'ip'}.'; now: '.$ip.' for '.$data{'username'}.':'.$data{'domain'}); |
Line 772 sub handler {
|
Line 773 sub handler {
|
# (and session) or has an LTI session cookie for a different username, |
# (and session) or has an LTI session cookie for a different username, |
# logout the existing session, and start a new one |
# logout the existing session, and start a new one |
if ($needslogout) { |
if ($needslogout) { |
&logout($r,$handle,\%data,$lti_env); |
&logout($r,$ip,$handle,\%data,$lti_env); |
} elsif (($data{'lti.reqcrs'}) && ($data{'lti.reqrole'} eq 'cc')) { |
} elsif (($data{'lti.reqcrs'}) && ($data{'lti.reqrole'} eq 'cc')) { |
$form{'lti.reqcrs'} = $data{'lti.reqcrs'}; |
$form{'lti.reqcrs'} = $data{'lti.reqcrs'}; |
$form{'lti.reqrole'} = $data{'lti.reqrole'}; |
$form{'lti.reqrole'} = $data{'lti.reqrole'}; |
Line 918 sub handler {
|
Line 919 sub handler {
|
$needslogout = 1; |
$needslogout = 1; |
} |
} |
if ($needslogout) { |
if ($needslogout) { |
&logout($r,$handle,\%data,$lti_env); |
&logout($r,$ip,$handle,\%data,$lti_env); |
return OK; |
return OK; |
} |
} |
} |
} |