Added failure_path_parameter to mirror target_path_parameter
This commit is contained in:
parent
9681973676
commit
d0057d0e64
@ -43,6 +43,7 @@ abstract class AbstractFactory implements SecurityFactoryInterface
|
|||||||
'failure_path' => null,
|
'failure_path' => null,
|
||||||
'failure_forward' => false,
|
'failure_forward' => false,
|
||||||
'login_path' => '/login',
|
'login_path' => '/login',
|
||||||
|
'failure_path_parameter' => '_failure_path',
|
||||||
);
|
);
|
||||||
|
|
||||||
public function create(ContainerBuilder $container, $id, $config, $userProviderId, $defaultEntryPointId)
|
public function create(ContainerBuilder $container, $id, $config, $userProviderId, $defaultEntryPointId)
|
||||||
|
@ -33,6 +33,7 @@ security:
|
|||||||
check_path: /login_check
|
check_path: /login_check
|
||||||
default_target_path: /profile
|
default_target_path: /profile
|
||||||
target_path_parameter: "user_login[_target_path]"
|
target_path_parameter: "user_login[_target_path]"
|
||||||
|
failure_path_parameter: "user_login[_failure_path]"
|
||||||
username_parameter: "user_login[username]"
|
username_parameter: "user_login[username]"
|
||||||
password_parameter: "user_login[password]"
|
password_parameter: "user_login[password]"
|
||||||
csrf_parameter: "user_login[_token]"
|
csrf_parameter: "user_login[_token]"
|
||||||
|
@ -50,9 +50,10 @@ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandle
|
|||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
|
||||||
$this->options = array_merge(array(
|
$this->options = array_merge(array(
|
||||||
'failure_path' => null,
|
'failure_path' => null,
|
||||||
'failure_forward' => false,
|
'failure_forward' => false,
|
||||||
'login_path' => '/login',
|
'login_path' => '/login',
|
||||||
|
'failure_path_parameter' => '_failure_path'
|
||||||
), $options);
|
), $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,6 +62,10 @@ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandle
|
|||||||
*/
|
*/
|
||||||
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
|
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']) {
|
if (null === $this->options['failure_path']) {
|
||||||
$this->options['failure_path'] = $this->options['login_path'];
|
$this->options['failure_path'] = $this->options['login_path'];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user