Skip to content

Commit 206ead0

Browse files
committed
Fix login/logout redirect method
1 parent db5b39d commit 206ead0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ZfcUser/Controller/UserController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function logoutAction()
118118
$redirect = $this->params()->fromPost('redirect', $this->params()->fromQuery('redirect', false));
119119

120120
if ($this->getOptions()->getUseRedirectParameterIfPresent() && $redirect) {
121-
return $this->redirect()->toUrl($redirect);
121+
return $this->redirect()->toRoute($redirect);
122122
}
123123

124124
return $this->redirect()->toRoute($this->getOptions()->getLogoutRedirectRoute());
@@ -155,7 +155,7 @@ public function authenticateAction()
155155
}
156156

157157
if ($this->getOptions()->getUseRedirectParameterIfPresent() && $redirect) {
158-
return $this->redirect()->toUrl($redirect);
158+
return $this->redirect()->toRoute($redirect);
159159
}
160160

161161
return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute());

tests/ZfcUserTest/Controller/UserControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public function testLogoutAction($withRedirect, $post, $query)
391391
->method('getUseRedirectParameterIfPresent')
392392
->will($this->returnValue((bool) $withRedirect));
393393
$redirect->expects($this->any())
394-
->method('toUrl')
394+
->method('toRoute')
395395
->with($expectedLocation)
396396
->will($this->returnValue($response));
397397
} else {
@@ -510,7 +510,7 @@ public function testAuthenticateAction($wantRedirect, $post, $query, $prepareRes
510510

511511
} elseif ($wantRedirect && $hasRedirect) {
512512
$redirect->expects($this->once())
513-
->method('toUrl')
513+
->method('toRoute')
514514
->with(($post ?: $query ?: false))
515515
->will($this->returnValue($response));
516516
} else {

0 commit comments

Comments
 (0)