--- loncom/auth/lonlogin.pm 2019/08/01 14:21:37 1.158.2.8 +++ loncom/auth/lonlogin.pm 2020/01/22 16:43:52 1.158.2.9.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.158.2.8 2019/08/01 14:21:37 raeburn Exp $ +# $Id: lonlogin.pm,v 1.158.2.9.2.1 2020/01/22 16:43:52 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -51,6 +51,11 @@ sub handler { if (!defined($env{'form.firsturl'})) { &Apache::lonacc::get_posted_cgi($r,['firsturl']); } + if (!defined($env{'form.firsturl'})) { + if ($ENV{'REDIRECT_URL'} =~ m{^/+tiny/+$LONCAPA::match_domain/+\w+$}) { + $env{'form.firsturl'} = $ENV{'REDIRECT_URL'}; + } + } # -- check if they are a migrating user if (defined($env{'form.token'})) { @@ -76,15 +81,19 @@ sub handler { &Apache::lonlocal::get_language_handle($r); &Apache::loncommon::content_type($r,'text/html'); if ($expirepub) { - my $c = new CGI::Cookie(-name => 'lonID', + my $c = new CGI::Cookie(-name => 'lonPubID', -value => '', -expires => '-10y',); $r->header_out('Set-cookie' => $c); } elsif (($handle eq '') && ($userdom ne '')) { - my $c = new CGI::Cookie(-name => 'lonID', - -value => '', - -expires => '-10y',); - $r->headers_out->add('Set-cookie' => $c); + my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); + foreach my $name (keys(%cookies)) { + next unless ($name =~ /^lon(|S|Link|Pub)ID$/); + my $c = new CGI::Cookie(-name => $name, + -value => '', + -expires => '-10y',); + $r->headers_out->add('Set-cookie' => $c); + } } $r->send_http_header; return OK if $r->header_only;