--- loncom/auth/lonauth.pm 2022/07/08 15:40:03 1.121.2.24.2.4
+++ loncom/auth/lonauth.pm 2023/01/23 00:38:50 1.121.2.24.2.6
@@ -1,7 +1,7 @@
# The LearningOnline Network
# User Authentication Module
#
-# $Id: lonauth.pm,v 1.121.2.24.2.4 2022/07/08 15:40:03 raeburn Exp $
+# $Id: lonauth.pm,v 1.121.2.24.2.6 2023/01/23 00:38:50 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -46,7 +46,7 @@ use CGI::Cookie();
# ------------------------------------------------------------ Successful login
sub success {
my ($r, $username, $domain, $authhost, $lowerurl, $extra_env,
- $form,$cid,$expirepub) = @_;
+ $form,$cid,$expirepub,$write_to_opener) = @_;
# ------------------------------------------------------------ Get cookie ready
my $cookie =
@@ -116,6 +116,10 @@ sub success {
$destination .= 'selectrole=1&'.$newrole.'=1';
}
}
+ } elsif (defined($form->{display})) {
+ if ($destination =~ m{^/adm/email($|\?)}) {
+ $destination .= ($destination =~ /\?/) ? '&' : '?' .'display='.&escape($form->{display});
+ }
}
if (defined($form->{symb})) {
my $destsymb = $form->{symb};
@@ -178,9 +182,17 @@ sub success {
&Apache::lonnet::appenv({'environment.remote' => 'off'});
}
}
+ my $startupremote;
+ if ($write_to_opener) {
+ if ($env{'environment.remote'} eq 'on') {
+ &Apache::lonnet::appenv({'environment.remote' => 'off'});
+ }
+ $args->{'redirect'} = [0,$destination,'',$write_to_opener];
+ } else {
+ $startupremote=&Apache::lonmenu::startupremote($destination);
+ }
my $windowinfo=&Apache::lonmenu::open($env{'browser.os'});
- my $startupremote=&Apache::lonmenu::startupremote($destination);
my $remoteinfo=&Apache::lonmenu::load_remote_msg($lowerurl);
my $setflags=&Apache::lonmenu::setflags();
my $maincall=&Apache::lonmenu::maincall();
@@ -190,7 +202,9 @@ sub success {
my $continuelink;
if ($env{'environment.remote'} eq 'off') {
- $continuelink=''.&mt('Continue').'';
+ unless ($write_to_opener) {
+ $continuelink=''.&mt('Continue').'';
+ }
}
# ------------------------------------------------- Output for successful login
@@ -749,6 +763,11 @@ sub handler {
}
if ($form{'firsturl'} =~ m{^/tiny/$match_domain/\w+$}) {
&set_deeplink_login(%form);
+ } elsif ($firsturl eq '/adm/email') {
+ if ($form{'display'} && ($form{'mailrecip'} eq "$form{'uname'}:$form{'udom'}")) {
+ $env{'request.display'} = $form{'display'};
+ $env{'request.mailrecip'} = $form{'mailrecip'};
+ }
}
$r->internal_redirect($switchto);
} else {
@@ -785,6 +804,11 @@ sub handler {
}
if ($form{'firsturl'} =~ m{^/tiny/$match_domain/\w+$}) {
&set_deeplink_login(%form);
+ } elsif ($firsturl eq '/adm/email') {
+ if ($form{'display'} && ($form{'mailrecip'} eq "$form{'uname'}:$form{'udom'}")) {
+ $env{'request.display'} = $form{'display'};
+ $env{'request.mailrecip'} = $form{'mailrecip'};
+ }
}
$r->internal_redirect($switchto);
} else {
@@ -824,6 +848,11 @@ sub handler {
}
if ($form{'firsturl'} =~ m{^/tiny/$match_domain/\w+$}) {
&set_deeplink_login(%form);
+ } elsif ($firsturl eq '/adm/email') {
+ if ($form{'display'} && ($form{'mailrecip'} eq "$form{'uname'}:$form{'udom'}")) {
+ $env{'request.display'} = $form{'display'};
+ $env{'request.mailrecip'} = $form{'mailrecip'};
+ }
}
$r->internal_redirect('/adm/switchserver?otherserver='.$unloaded.'&origurl='.$firsturl);
return OK;
@@ -843,6 +872,14 @@ sub handler {
$form{$item} = $sessiondata{$item};
}
}
+ if ($sessiondata{'origurl'} eq '/adm/email') {
+ if (($sessiondata{'display'}) && ($sessiondata{'mailrecip'})) {
+ if (&unescape($sessiondata{'mailrecip'}) eq "$form{'uname'}:$form{'udom'}") {
+ $form{'display'} = &unescape($sessiondata{'display'});
+ $form{'mailrecip'} = &unescape($sessiondata{'mailrecip'});
+ }
+ }
+ }
}
}
if ($form{'linkprot'}) {
@@ -1041,6 +1078,11 @@ sub check_can_host {
$form);
if ($form->{'firsturl'} =~ m{^/tiny/$match_domain/\w+$}) {
$env{'request.deeplink.login'} = $form->{'firsturl'};
+ } elsif ($form->{'firsturl'} eq '/adm/email') {
+ if ($form->{'display'} && ($form->{'mailrecip'} eq $form->{'uname'}.':'.$form->{'udom'})) {
+ $env{'request.display'} = $form->{'mailrecip'};
+ $env{'request.mailrecip'} = $form->{'mailrecip'};
+ }
}
if ($form->{'linkprot'}) {
$env{'request.linkprot'} = $form->{'linkprot'};