Merge remote branch 'theinterned/patch-1'

* theinterned/patch-1:
  made logoutPath localizable as well
  storing localized targetPath in a string as opposed to updating the attribute
  In the spirit of 882a8e3f09 allow for localized logout target url
This commit is contained in:
Fabien Potencier 2011-06-11 07:39:04 +02:00
commit afa30d9864

View File

@ -69,7 +69,10 @@ class LogoutListener implements ListenerInterface
{
$request = $event->getRequest();
if ($this->logoutPath !== $request->getPathInfo()) {
$logoutPath = str_replace('{_locale}', $request->getSession()->getLocale(), $this->logoutPath);
$targetUrl = str_replace('{_locale}', $request->getSession()->getLocale(), $this->targetUrl);
if ($logoutPath !== $request->getPathInfo()) {
return;
}
@ -80,7 +83,7 @@ class LogoutListener implements ListenerInterface
throw new \RuntimeException('Logout Success Handler did not return a Response.');
}
} else {
$response = new RedirectResponse(0 !== strpos($this->targetUrl, 'http') ? $request->getUriForPath($this->targetUrl) : $this->targetUrl, 302);
$response = new RedirectResponse(0 !== strpos($targetUrl, 'http') ? $request->getUriForPath($targetUrl) : $targetUrl, 302);
}
// handle multiple logout attempts gracefully