--- loncom/auth/lonauth.pm 2021/11/03 01:04:02 1.169 +++ loncom/auth/lonauth.pm 2022/09/17 23:38:50 1.178 @@ -1,7 +1,7 @@ # The LearningOnline Network # User Authentication Module # -# $Id: lonauth.pm,v 1.169 2021/11/03 01:04:02 raeburn Exp $ +# $Id: lonauth.pm,v 1.178 2022/09/17 23:38:50 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,11 +42,12 @@ use Apache::lonlocal; use Apache::File(); use HTML::Entities; use Digest::MD5; +use CGI::Cookie(); # ------------------------------------------------------------ Successful login sub success { my ($r, $username, $domain, $authhost, $lowerurl, $extra_env, - $form,$skipcritical,$cid) = @_; + $form,$skipcritical,$cid,$expirepub,$write_to_opener) = @_; # ------------------------------------------------------------ Get cookie ready my $cookie = @@ -146,6 +147,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,11 +183,21 @@ sub success { $destination .= 'source=login'; } + my $brcrum = [{'href' => '', + 'text' => 'Successful Login'},]; + my $args = {'no_inline_link' => 1, + 'bread_crumbs' => $brcrum,}; if (($env{'request.deeplink.login'} eq $lowerurl) && (($env{'request.linkprot'}) || ($env{'request.linkkey'} ne ''))) { my %info; if ($env{'request.linkprot'}) { $info{'linkprot'} = $env{'request.linkprot'}; + foreach my $item ('linkprotuser','linkprotexit') { + if ($form->{$item}) { + $info{$item} = $form->{$item}; + } + } + $args = {'only_body' => 1,}; } elsif ($env{'request.linkkey'} ne '') { $info{'linkkey'} = $env{'request.linkkey'}; } @@ -199,9 +214,6 @@ sub success { $windowname .= 'lti'; } my $windowinfo = Apache::lonhtmlcommon::scripttag('self.name="'.$windowname.'";'); - my $brcrum = [{'href' => '', - 'text' => 'Successful Login'},]; - my $args = {'bread_crumbs' => $brcrum,}; unless ((defined($form->{role})) || (defined($form->{symb}))) { my $update=$env{'user.update.time'}; if (!$update) { @@ -233,6 +245,12 @@ sub success { if ($defaultcookie) { $r->headers_out->add('Set-cookie' => $defaultcookie); } + if ($expirepub) { + my $c = new CGI::Cookie(-name => 'lonPubID', + -value => '', + -expires => '-10y',); + $r->headers_out->add('Set-cookie' => $c); + } $r->send_http_header; my ($start_page,$js,$pagebody,$end_page); @@ -241,6 +259,7 @@ sub success { if ($env{'request.lti.target'} eq '') { my $ltitarget = (($destination =~ /\?/) ? '&' : '?'). 'ltitarget=iframe'; + &js_escape(\$destination); $js = <<"ENDJS";