--- loncom/auth/migrateuser.pm 2022/07/02 19:55:15 1.64 +++ loncom/auth/migrateuser.pm 2023/06/02 01:20:26 1.67 @@ -1,7 +1,7 @@ # The LearningOnline Network # Starts a user off based of an existing token. # -# $Id: migrateuser.pm,v 1.64 2022/07/02 19:55:15 raeburn Exp $ +# $Id: migrateuser.pm,v 1.67 2023/06/02 01:20:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,6 +42,10 @@ use CGI::Cookie; sub goto_login { my ($r,$domain,$data) = @_; + my $write_to_opener; + if (ref($data) eq 'HASH') { + $write_to_opener = $data->{'lcssowin'}; + } if ((ref($data) eq 'HASH') && ($data->{'lti.login'})) { &Apache::ltiauth::invalid_request($r,'22'); } else { @@ -52,7 +56,7 @@ sub goto_login { $url .= '?domain='.$domain; } $r->print(&Apache::loncommon::start_page('Going to login',undef, - {'redirect' => [0,$url],}). + {'redirect' => [0,$url,'',$write_to_opener],}). '

'.&mt('One moment please...').'

'. '

'.&mt('Transferring to login page.').'

'. &Apache::loncommon::end_page()); @@ -285,19 +289,27 @@ sub ip_changed { 'username' => $dataref->{'username'}, 'sessionserver' => $lonhost, ); - my @names = ('origurl','symb','role','linkprotuser','linkprotexit','linkprot','linkkey'); + my @names = ('origurl','symb','role','linkprotuser','linkprotexit','linkprot','linkkey','linkprotpbid','linkprotpburl'); foreach my $name (@names) { if ($dataref->{$name} ne '') { $info{$name} = $dataref->{$name}; } } + if ($info{'origurl'} eq '/adm/email') { + if (($dataref->{'display'}) && ($dataref->{'mailrecip'})) { + if (&unescape($dataref->{'mailrecip'}) eq $dataref->{'username'}.':'.$dataref->{'domain'}) { + $info{'display'} = $dataref->{'display'}; + $info{'mailrecip'} = $dataref->{'mailrecip'}; + } + } + } my $iptoken = &Apache::lonnet::tmpput(\%info,$switchto,'link'); unless ($iptoken eq 'conlost') { $url .= (($url =~ /\?/) ? '&' : '?') . 'iptoken='.$iptoken; } $r->print(&Apache::loncommon::start_page($title,undef, {'redirect' => - [2,$url],}). + [2,$url,'',$dataref->{'lcssowin'}],}). '

'.&mt('One moment please...').'

'. '

'.$message.'

'. &Apache::loncommon::end_page()); @@ -336,7 +348,7 @@ sub logout { $r->headers_out->add('Set-cookie' => $c); } my $lonhost = $r->dir_config('lonHostID'); - my ($url,$token,$delay,%info,%user_info); + my ($url,$token,$delay,$write_to_opener,%info,%user_info); if (ref($data) eq 'HASH') { %user_info=('ip' => $ip, 'domain' => $data->{'domain'}, @@ -346,6 +358,7 @@ sub logout { 'origurl' => $data->{'origurl'}, 'symb' => $data->{'symb'}, 'server' => $lonhost); + $write_to_opener = $data->{'lcssowin'}; } $delay = 0.1; if (ref($linkprot_info) eq 'HASH') { @@ -379,7 +392,7 @@ sub logout { $r->send_http_header; $r->print( &Apache::loncommon::start_page('Updating Session ...',undef, - {'redirect' => [$delay,$url], + {'redirect' => [$delay,$url,'',$write_to_opener], 'only_body' => 1,}). &Apache::loncommon::end_page()); if ($env{'request.balancercookie'}) { @@ -747,6 +760,12 @@ sub handler { unless ($env{'request.linkprotexit'} eq $data{'linkprotexit'}) { $checklaunch = 1; } + unless ($env{'request.linkprotpbid'} eq $data{'linkprotpbid'}) { + $checklaunch = 1; + } + unless ($env{'request.linkprotpburl'} eq $data{'linkprotpburl'}) { + $checklaunch = 1; + } unless ($env{'request.linkkey'} eq $data{'linkkey'}) { $checklaunch = 1; } @@ -758,7 +777,7 @@ sub handler { if (($env{'user.name'} ne $data{'username'}) || ($env{'user.domain'} ne $data{'domain'})) { my %linkprot_env; - foreach my $item ('linkprot','linkprotexit','deeplink.login') { + foreach my $item ('linkprot','linkprotexit','linkprotpbid','linkprotpburl','deeplink.login') { if ($data{$item}) { $linkprot_env{$item} = $data{$item}; } @@ -908,7 +927,7 @@ sub handler { my %info; if ($env{'request.linkprot'}) { $info{'linkprot'} = $env{'request.linkprot'}; - foreach my $item ('linkprotuser','linkprotexit') { + foreach my $item ('linkprotuser','linkprotexit','linkprotpbid','linkprotpburl') { if ($data{$item}) { $info{$item} = $data{$item}; } @@ -967,8 +986,14 @@ sub handler { if ($data{'linkprotexit'}) { $extra_env->{'request.linkprotexit'} = $data{'linkprotexit'}; } + if ($data{'linkprotpbid'}) { + $extra_env->{'request.linkprotpbid'} = $data{'linkprotpbid'}; + } + if ($data{'linkprotpburl'}) { + $extra_env->{'request.linkprotpburl'} = $data{'linkprotpburl'}; + } } - foreach my $item ('linkprotuser','linkprotexit') { + foreach my $item ('linkprotuser','linkprotexit','linkprotpbid','linkprotpburl') { if ($data{$item} ne '') { $form{$item} = $data{$item}; } @@ -991,6 +1016,13 @@ sub handler { $extra_env = {'request.deeplink.login' => $data{'deeplink.login'}}; } } + if ($desturl eq '/adm/email') { + if (($data{'display'}) && ($data{'mailrecip'})) { + if (&unescape($data{'mailrecip'}) eq "$data{'username'}:$data{'domain'}") { + $form{'display'} = &unescape($data{'display'}); + } + } + } } my $skipcritical; if ($data{'lti.login'}) { @@ -1002,7 +1034,7 @@ sub handler { } &Apache::lonauth::success($r,$data{'username'},$data{'domain'}, $home,$desturl,$extra_env,\%form,$skipcritical,'', - $expirepub); + $expirepub,$data{'lcssowin'}); } return OK; } @@ -1073,7 +1105,13 @@ sub handler { if ($data{'linkprotexit'}) { $extra_env->{'request.linkprotexit'} = $data{'linkprotexit'}; } - foreach my $item ('linkprotuser','linkprotexit') { + if ($data{'linkprotpbid'}) { + $extra_env->{'request.linkprotpassbid'} = $data{'linkprotpbid'}; + } + if ($data{'linkprotpburl'}) { + $extra_env->{'request.linkprotpassburl'} = $data{'linkprotpburl'}; + } + foreach my $item ('linkprotuser','linkprotexit','linkprotpbid','linkprotpburl') { if ($data{$item}) { $form{'request.'.$item} = $data{$item}; } @@ -1083,7 +1121,7 @@ sub handler { } } &Apache::lonauth::success($r,$data{'username'},$data{'domain'},$home, - $next_url,$extra_env,\%form,'',$cid); + $next_url,$extra_env,\%form,'',$cid,'',$data{'lcssowin'}); } return OK; }