Code Duplication    Length = 31-34 lines in 2 locations

src/Eccube/Controller/ShoppingController.php 1 location

@@ 559-589 (lines=31) @@
556
     * @Route("/shopping/login", name="shopping_login")
557
     * @Template("Shopping/login.twig")
558
     */
559
    public function login(Request $request, AuthenticationUtils $authenticationUtils)
560
    {
561
        if ($this->isGranted('IS_AUTHENTICATED_FULLY')) {
562
            return $this->redirectToRoute('shopping');
563
        }
564
565
        /* @var $form \Symfony\Component\Form\FormInterface */
566
        $builder = $this->formFactory->createNamedBuilder('', CustomerLoginType::class);
567
568
        if ($this->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
569
            $Customer = $this->getUser();
570
            if ($Customer) {
571
                $builder->get('login_email')->setData($Customer->getEmail());
572
            }
573
        }
574
575
        $event = new EventArgs(
576
            [
577
                'builder' => $builder,
578
            ],
579
            $request
580
        );
581
        $this->eventDispatcher->dispatch(EccubeEvents::FRONT_SHOPPING_LOGIN_INITIALIZE, $event);
582
583
        $form = $builder->getForm();
584
585
        return [
586
            'error' => $authenticationUtils->getLastAuthenticationError(),
587
            'form' => $form->createView(),
588
        ];
589
    }
590
591
    /**
592
     * 購入エラー画面表示

src/Eccube/Controller/Mypage/MypageController.php 1 location

@@ 100-133 (lines=34) @@
97
     * @Route("/mypage/login", name="mypage_login")
98
     * @Template("Mypage/login.twig")
99
     */
100
    public function login(Request $request, AuthenticationUtils $utils)
101
    {
102
        if ($this->isGranted('IS_AUTHENTICATED_FULLY')) {
103
            log_info('認証済のためログイン処理をスキップ');
104
105
            return $this->redirectToRoute('mypage');
106
        }
107
108
        /* @var $form \Symfony\Component\Form\FormInterface */
109
        $builder = $this->formFactory
110
            ->createNamedBuilder('', CustomerLoginType::class);
111
112
        if ($this->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
113
            $Customer = $this->getUser();
114
            if ($Customer instanceof Customer) {
115
                $builder->get('login_email')
116
                    ->setData($Customer->getEmail());
117
            }
118
        }
119
120
        $event = new EventArgs(
121
            [
122
                'builder' => $builder,
123
            ],
124
            $request
125
        );
126
        $this->eventDispatcher->dispatch(EccubeEvents::FRONT_MYPAGE_MYPAGE_LOGIN_INITIALIZE, $event);
127
128
        $form = $builder->getForm();
129
130
        return [
131
            'error' => $utils->getLastAuthenticationError(),
132
            'form' => $form->createView(),
133
        ];
134
    }
135
136
    /**