merged branch snc/login-referer (PR #2518)

Commits
-------

f9a65ba Redirect to default_target_path if use_referer is true and the referer is the login_path.

Discussion
----------

Login redirect

Bug fix: no
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes

Redirect to default_target_path if use_referer is true and the referer is the login_path.

---------------------------------------------------------------------------

by Seldaek at 2011/10/30 10:52:38 -0700

👍

---------------------------------------------------------------------------

by stealth35 at 2011/10/30 11:04:16 -0700

@snc BC break ?

---------------------------------------------------------------------------

by snc at 2011/10/30 12:11:39 -0700

Well I'm sure it is never intended by a developer to be redirected to the login page after logging in but it could be possible that the controller which displays the login form handles this case, so my change would break it.
This commit is contained in:
Fabien Potencier 2011-11-17 07:41:20 +01:00
commit 1ae3682bb9

View File

@ -273,7 +273,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
return $targetUrl;
}
if ($this->options['use_referer'] && $targetUrl = $request->headers->get('Referer')) {
if ($this->options['use_referer'] && ($targetUrl = $request->headers->get('Referer')) && $targetUrl !== $request->getUriForPath($this->options['login_path'])) {
return $targetUrl;
}