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

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