Skip to content

Commit

Permalink
Fix login/logout redirect method
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielss89 committed Jun 8, 2014
1 parent db5b39d commit 206ead0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ZfcUser/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function logoutAction()
$redirect = $this->params()->fromPost('redirect', $this->params()->fromQuery('redirect', false));

if ($this->getOptions()->getUseRedirectParameterIfPresent() && $redirect) {
return $this->redirect()->toUrl($redirect);
return $this->redirect()->toRoute($redirect);
}

return $this->redirect()->toRoute($this->getOptions()->getLogoutRedirectRoute());
Expand Down Expand Up @@ -155,7 +155,7 @@ public function authenticateAction()
}

if ($this->getOptions()->getUseRedirectParameterIfPresent() && $redirect) {
return $this->redirect()->toUrl($redirect);
return $this->redirect()->toRoute($redirect);
}

return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute());
Expand Down
4 changes: 2 additions & 2 deletions tests/ZfcUserTest/Controller/UserControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public function testLogoutAction($withRedirect, $post, $query)
->method('getUseRedirectParameterIfPresent')
->will($this->returnValue((bool) $withRedirect));
$redirect->expects($this->any())
->method('toUrl')
->method('toRoute')
->with($expectedLocation)
->will($this->returnValue($response));
} else {
Expand Down Expand Up @@ -510,7 +510,7 @@ public function testAuthenticateAction($wantRedirect, $post, $query, $prepareRes

} elseif ($wantRedirect && $hasRedirect) {
$redirect->expects($this->once())
->method('toUrl')
->method('toRoute')
->with(($post ?: $query ?: false))
->will($this->returnValue($response));
} else {
Expand Down

1 comment on commit 206ead0

@kusmierz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Danielss89 Why have you changed this behavior? Now I can only redirect to route, without any params...

Please sign in to comment.