Code Duplication    Length = 31-34 lines in 2 locations

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

@@ 80-113 (lines=34) @@
77
     * @Route("/mypage/login", name="mypage_login")
78
     * @Template("Mypage/login.twig")
79
     */
80
    public function login(Request $request, AuthenticationUtils $utils)
81
    {
82
        if ($this->isGranted('IS_AUTHENTICATED_FULLY')) {
83
            log_info('認証済のためログイン処理をスキップ');
84
85
            return $this->redirectToRoute('mypage');
86
        }
87
88
        /* @var $form \Symfony\Component\Form\FormInterface */
89
        $builder = $this->formFactory
90
            ->createNamedBuilder('', CustomerLoginType::class);
91
92
        if ($this->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
93
            $Customer = $this->getUser();
94
            if ($Customer instanceof Customer) {
95
                $builder->get('login_email')->setData($Customer->getEmail());
96
            }
97
        }
98
99
        $event = new EventArgs(
100
            [
101
                'builder' => $builder,
102
            ],
103
            $request
104
        );
105
        $this->eventDispatcher->dispatch(EccubeEvents::FRONT_MYPAGE_MYPAGE_LOGIN_INITIALIZE, $event);
106
107
        $form = $builder->getForm();
108
109
        return [
110
            'error' => $utils->getLastAuthenticationError(),
111
            'form' => $form->createView(),
112
        ];
113
    }
114
115
    /**
116
     * マイページ.

src/Eccube/Controller/ShoppingController.php 1 location

@@ 537-567 (lines=31) @@
534
     * @Route("/shopping/login", name="shopping_login")
535
     * @Template("Shopping/login.twig")
536
     */
537
    public function login(Request $request, AuthenticationUtils $authenticationUtils)
538
    {
539
        if ($this->isGranted('IS_AUTHENTICATED_FULLY')) {
540
            return $this->redirectToRoute('shopping');
541
        }
542
543
        /* @var $form \Symfony\Component\Form\FormInterface */
544
        $builder = $this->formFactory->createNamedBuilder('', CustomerLoginType::class);
545
546
        if ($this->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
547
            $Customer = $this->getUser();
548
            if ($Customer) {
549
                $builder->get('login_email')->setData($Customer->getEmail());
550
            }
551
        }
552
553
        $event = new EventArgs(
554
            [
555
                'builder' => $builder,
556
            ],
557
            $request
558
        );
559
        $this->eventDispatcher->dispatch(EccubeEvents::FRONT_SHOPPING_LOGIN_INITIALIZE, $event);
560
561
        $form = $builder->getForm();
562
563
        return [
564
            'error' => $authenticationUtils->getLastAuthenticationError(),
565
            'form' => $form->createView(),
566
        ];
567
    }
568
569
    /**
570
     * 購入エラー画面表示