Skip to content
Permalink
Browse files

Item2083: If original url is for the rest script, bypass the redirect…

…_cache when redirecting from login

This seems to fix the bad rest handler when returning from the MetaCommentPlugin post.  I don't 
believe that this is the correct / best fix, but it seems to work.  This needs some careful review.


git-svn-id: http://svn.foswiki.org/trunk@7312 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information...
GeorgeClark GeorgeClark
GeorgeClark authored and GeorgeClark committed May 3, 2010
1 parent 1fd5a66 commit 4dd2e1863125e1b6a71d28fc5d3bb177deb835eb
Showing with 7 additions and 2 deletions.
  1. +7 −2 core/lib/Foswiki/LoginManager/TemplateLogin.pm
@@ -120,7 +120,8 @@ sub login {
my $loginName = $query->param('username');
my $loginPass = $query->param('password');
my $remember = $query->param('remember');
print STDERR "ENTERING login \n";
#print STDERR "ENTERING login \n";
#print STDERR " ... origurl =" . $origurl || '' . "\n";

# Eat these so there's no risk of accidental passthrough
$query->delete( 'origurl', 'username', 'password' );
@@ -154,6 +155,7 @@ sub login {
$error = $users->passwordError();

if ($validation) {
#print STDERR "VALIDATE successful, origurl still $origurl, Query URL = " . $query->url() . " \n";

# SUCCESS our user is authenticated. Note that we may already
# have been logged in by the userLoggedIn call in loadSession,
@@ -169,6 +171,8 @@ sub login {

my $nocache = 0; # Set to true if login is returning an original url

$nocache = 1 if ($origurl =~ m/^$Foswiki::cfg{ScriptUrlPath}\/rest\//);

$cgisession->param( 'VALIDATION', $validation ) if $cgisession;
if ( !$origurl || $origurl eq $query->url() ) {
$origurl = $session->getScriptUrl( 0, 'view', $web, $topic );
@@ -191,7 +195,8 @@ sub login {
}

# Redirect with passthrough
print STDERR "Issuing REDIRECT from login \n";
#print STDERR "Issuing REDIRECT from login, nocache = $nocache, origurl = $origurl \n";
#print STDERR " PATHINFO " . $session->{request}->pathInfo() . " \n";
$session->redirect( $origurl, 1, $nocache ); # with passthrough
return;
}

0 comments on commit 4dd2e18

Please sign in to comment.
You can’t perform that action at this time.