version 1.13, 2021/12/06 03:31:54
|
version 1.18, 2023/06/02 01:20:26
|
Line 202 information, and the destination is a de
|
Line 202 information, and the destination is a de
|
then the LTI number, type (c or d), and tiny URL will be saved as the |
then the LTI number, type (c or d), and tiny URL will be saved as the |
linkprot item in a token file. |
linkprot item in a token file. |
|
|
|
=item set_mailtoken() |
|
|
|
Inputs: 2 |
|
$r - request object |
|
$lonhost - hostID of current server |
|
|
|
Output: 1 |
|
$querystring - query string to append to URL |
|
when redirecting. |
|
|
|
Called if requested URL is /adm/email, dual SSO and non-SSO login |
|
are supported by /adm/login and original query string contains values |
|
for elements: display, username and domain, which will then be |
|
stored in the token file on the server to support direct access |
|
to a specific message sent to the user. |
|
|
=back |
=back |
|
|
=cut |
=cut |
Line 234 sub handler {
|
Line 250 sub handler {
|
unless ($protocol eq 'https') { $protocol = 'http'; } |
unless ($protocol eq 'https') { $protocol = 'http'; } |
my $alias = &Apache::lonnet::use_proxy_alias($r,$lonhost); |
my $alias = &Apache::lonnet::use_proxy_alias($r,$lonhost); |
if (($alias ne '') && |
if (($alias ne '') && |
(&Apache::lonnet::alias_shibboleth($lonhost))) { |
(&Apache::lonnet::alias_sso($lonhost))) { |
$hostname = $alias; |
$hostname = $alias; |
} |
} |
my $dest = $protocol.'://'.$hostname.$target; |
my $dest = $protocol.'://'.$hostname.$target; |
if ($target eq '/adm/login') { |
if ($target eq '/adm/login') { |
my $querystring = &set_token($r,$lonhost); |
my $uri = $r->uri; |
|
my $querystring; |
|
if (($uri eq '/adm/email') && ($r->args ne '')) { |
|
$querystring = &set_mailtoken($r,$lonhost); |
|
} else { |
|
$querystring = &set_token($r,$lonhost); |
|
} |
if ($querystring ne '') { |
if ($querystring ne '') { |
$dest .= '?'.$querystring; |
$dest .= '?'.$querystring; |
} |
} |
Line 250 sub handler {
|
Line 272 sub handler {
|
if ($querystring ne '') { |
if ($querystring ne '') { |
$dest .= '?'.$querystring; |
$dest .= '?'.$querystring; |
} |
} |
|
} elsif ((&Apache::lonnet::get_saml_landing()) && |
|
($uri eq '/adm/email') && ($r->args ne '')) { |
|
my $querystring = &set_mailtoken($r,$lonhost); |
|
if ($querystring ne '') { |
|
$dest .= '?'.$querystring; |
|
} |
} else { |
} else { |
if ($r->args ne '') { |
if ($r->args ne '') { |
$dest .= (($dest=~/\?/)?'&':'?').$r->args; |
$dest .= (($dest=~/\?/)?'&':'?').$r->args; |
Line 293 sub set_token {
|
Line 321 sub set_token {
|
&Apache::lonacc::get_posted_cgi($r,['linkkey']); |
&Apache::lonacc::get_posted_cgi($r,['linkkey']); |
} |
} |
} |
} |
|
unless (($r->is_initial_req()) || ($env{'form.ltoken'}) || |
|
($env{'form.linkkey'})) { |
|
return; |
|
} |
} |
} |
my $extras; |
my $extras; |
foreach my $name (@names) { |
foreach my $name (@names) { |
Line 302 sub set_token {
|
Line 334 sub set_token {
|
&Apache::lonnet::tmpdel($env{'form.ltoken'}); |
&Apache::lonnet::tmpdel($env{'form.ltoken'}); |
if ($info{'linkprot'}) { |
if ($info{'linkprot'}) { |
$extras .= '&linkprot='.&escape($info{'linkprot'}); |
$extras .= '&linkprot='.&escape($info{'linkprot'}); |
|
foreach my $item ('linkprotuser','linkprotexit','linkprotpbid','linkprotpburl') { |
|
if ($info{$item} ne '') { |
|
$extras .= '&'.$item.'='.&escape($info{$item}); |
|
} |
|
} |
last; |
last; |
} |
} |
} else { |
} else { |
Line 323 sub set_token {
|
Line 360 sub set_token {
|
$querystring .= '&'.$name.'='.$env{$key}; |
$querystring .= '&'.$name.'='.$env{$key}; |
} |
} |
} |
} |
|
} |
|
return $querystring; |
|
} |
|
|
|
sub set_mailtoken { |
|
my ($r,$lonhost) = @_; |
|
my $firsturl = $r->uri; |
|
my ($querystring,$ssotoken,$extras); |
|
&Apache::loncommon::get_unprocessed_cgi($r->args); |
|
my $extras; |
|
if (($env{'form.display'} ne '') && |
|
($env{'form.username'} =~ /^$match_username$/) && |
|
($env{'form.domain'} =~ /^$match_domain$/)) { |
|
$extras .= '&display='.&escape($env{'form.display'}). |
|
'&mailrecip='.&escape($env{'form.username'}.':'.$env{'form.domain'}); |
|
} |
|
if (($firsturl ne '') || ($extras ne '')) { |
|
$extras .= ':sso'; |
|
$ssotoken = &Apache::lonnet::reply('tmpput:'.&escape($firsturl). |
|
$extras,$lonhost); |
|
$querystring = 'sso='.$ssotoken; |
|
} |
|
if ($r->args ne '') { |
|
foreach my $key (sort(keys(%env))) { |
|
if ($key =~ /^form\.(.+)$/) { |
|
my $name = $1; |
|
next if (($name eq 'display') || ($name eq 'username') || ($name eq 'domain')); |
|
$querystring .= '&'.$name.'='.$env{$key}; |
|
} |
|
} |
} |
} |
return $querystring; |
return $querystring; |
} |
} |