summaryrefslogtreecommitdiffstats
path: root/Http
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2012-12-06 14:11:06 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2012-12-06 14:11:06 +0100
commit7c66d5298e8a153f3c3a658543ca2a699c0cb98b (patch)
treeade1fa3cc4c3f6e11ece304f23877c112b44b75b /Http
parent776462d0999054c52084f4c529606103bcccd8b3 (diff)
parent8ad22e67c33c004ee35fa53684954d2894b07dcb (diff)
downloadsymfony-security-7c66d5298e8a153f3c3a658543ca2a699c0cb98b.zip
symfony-security-7c66d5298e8a153f3c3a658543ca2a699c0cb98b.tar.gz
symfony-security-7c66d5298e8a153f3c3a658543ca2a699c0cb98b.tar.bz2
merged branch leevigraham/failure_path (PR #5860)
This PR was squashed before being merged into the master branch (closes #5860). Commits ------- d0057d0 Added failure_path_parameter to mirror target_path_parameter Discussion ---------- Added failure_path_parameter to mirror target_path_parameter Bug fix: no Feature addition: yes Backwards compatibility break: no Symfony2 tests pass: yes License of the code: MIT Enable login failure redirect path can be assigned in a form field just like target path. --------------------------------------------------------------------------- by stof at 2012-10-29T09:40:17Z Please also open a PR to the doc repo to document this new feature --------------------------------------------------------------------------- by leevigraham at 2012-10-29T09:56:29Z @stof @fabpot Done.
Diffstat (limited to 'Http')
-rw-r--r--Http/Authentication/DefaultAuthenticationFailureHandler.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/Http/Authentication/DefaultAuthenticationFailureHandler.php b/Http/Authentication/DefaultAuthenticationFailureHandler.php
index 61d77a8..d543745 100644
--- a/Http/Authentication/DefaultAuthenticationFailureHandler.php
+++ b/Http/Authentication/DefaultAuthenticationFailureHandler.php
@@ -50,9 +50,10 @@ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandle
$this->logger = $logger;
$this->options = array_merge(array(
- 'failure_path' => null,
- 'failure_forward' => false,
- 'login_path' => '/login',
+ 'failure_path' => null,
+ 'failure_forward' => false,
+ 'login_path' => '/login',
+ 'failure_path_parameter' => '_failure_path'
), $options);
}
@@ -61,6 +62,10 @@ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandle
*/
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
+ if ($failureUrl = $request->get($this->options['failure_path_parameter'], null, true)) {
+ $this->options['failure_path'] = $failureUrl;
+ }
+
if (null === $this->options['failure_path']) {
$this->options['failure_path'] = $this->options['login_path'];
}