| @@ 20-36 (lines=17) @@ | ||
| 17 | use Symfony\Component\Security\Core\Exception\AuthenticationException; |
|
| 18 | use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler; |
|
| 19 | ||
| 20 | class EccubeAuthenticationFailureHandler extends DefaultAuthenticationFailureHandler |
|
| 21 | { |
|
| 22 | /** |
|
| 23 | * {@inheritdoc} |
|
| 24 | */ |
|
| 25 | public function onAuthenticationFailure(Request $request, AuthenticationException $exception) |
|
| 26 | { |
|
| 27 | $response = parent::onAuthenticationFailure($request, $exception); |
|
| 28 | $location = $response->headers->get('location'); |
|
| 29 | if (null !== $location && preg_match('/^https?:\\\\/i', $location)) { |
|
| 30 | return $this->httpUtils->createRedirectResponse($request, '/'); |
|
| 31 | } |
|
| 32 | ||
| 33 | return $response; |
|
| 34 | } |
|
| 35 | ||
| 36 | } |
|
| 37 | ||
| @@ 20-35 (lines=16) @@ | ||
| 17 | use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; |
|
| 18 | use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler; |
|
| 19 | ||
| 20 | class EccubeAuthenticationSuccessHandler extends DefaultAuthenticationSuccessHandler |
|
| 21 | { |
|
| 22 | /** |
|
| 23 | * {@inheritdoc} |
|
| 24 | */ |
|
| 25 | public function onAuthenticationSuccess(Request $request, TokenInterface $token) |
|
| 26 | { |
|
| 27 | $response = parent::onAuthenticationSuccess($request, $token); |
|
| 28 | $location = $response->headers->get('location'); |
|
| 29 | if (null !== $location && preg_match('/^https?:\\\\/i', $location)) { |
|
| 30 | return $this->httpUtils->createRedirectResponse($request, '/'); |
|
| 31 | } |
|
| 32 | ||
| 33 | return $response; |
|
| 34 | } |
|
| 35 | } |
|
| 36 | ||