Code Duplication    Length = 16-17 lines in 2 locations

src/Eccube/Security/Http/Authentication/EccubeAuthenticationFailureHandler.php 1 location

@@ 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
29
        if (preg_match('/^https?:\\\\/i', $response->getTargetUrl())) {
30
            $response->setTargetUrl($request->getUriForPath('/'));
31
        }
32
33
        return $response;
34
    }
35
36
}
37

src/Eccube/Security/Http/Authentication/EccubeAuthenticationSuccessHandler.php 1 location

@@ 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
29
        if (preg_match('/^https?:\\\\/i', $response->getTargetUrl())) {
30
            $response->setTargetUrl($request->getUriForPath('/'));
31
        }
32
33
        return $response;
34
    }
35
}
36