Skip to content

Commit

Permalink
Item2083: If original url is for the rest script, bypass the redirect…
Browse files Browse the repository at this point in the history
…_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 authored and GeorgeClark committed May 3, 2010
1 parent 1fd5a66 commit 4dd2e18
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/lib/Foswiki/LoginManager/TemplateLogin.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ sub login {
my $loginName = $query->param('username'); my $loginName = $query->param('username');
my $loginPass = $query->param('password'); my $loginPass = $query->param('password');
my $remember = $query->param('remember'); 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 # Eat these so there's no risk of accidental passthrough
$query->delete( 'origurl', 'username', 'password' ); $query->delete( 'origurl', 'username', 'password' );
Expand Down Expand Up @@ -154,6 +155,7 @@ sub login {
$error = $users->passwordError(); $error = $users->passwordError();


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


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


my $nocache = 0; # Set to true if login is returning an original url 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; $cgisession->param( 'VALIDATION', $validation ) if $cgisession;
if ( !$origurl || $origurl eq $query->url() ) { if ( !$origurl || $origurl eq $query->url() ) {
$origurl = $session->getScriptUrl( 0, 'view', $web, $topic ); $origurl = $session->getScriptUrl( 0, 'view', $web, $topic );
Expand All @@ -191,7 +195,8 @@ sub login {
} }


# Redirect with passthrough # 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 $session->redirect( $origurl, 1, $nocache ); # with passthrough
return; return;
} }
Expand Down

0 comments on commit 4dd2e18

Please sign in to comment.