| @@ 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 | * マイページ. |
|
| @@ 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 | * 購入エラー画面表示 |
|