From 00d68472071f5e2b0c553f6afb47e32832ddc14a Mon Sep 17 00:00:00 2001 From: Chihiro Adachi <8196725+chihiro-adachi@users.noreply.github.com> Date: Thu, 21 Jul 2022 15:56:34 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Revert=20"=E4=BC=9A=E5=93=A1=E7=99=BB?= =?UTF-8?q?=E9=8C=B2=E6=B8=88=E3=81=BF=E3=81=AE=E3=83=A1=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=82=A2=E3=83=89=E3=83=AC=E3=82=B9=E3=82=92=E5=88=A4=E5=88=A5?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E3=81=AB=E3=81=99=E3=82=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codeception/acceptance/EF04CustomerCest.php | 5 +- src/Eccube/Controller/EntryController.php | 214 +++++++----------- src/Eccube/Entity/Customer.php | 10 + src/Eccube/Form/Type/Admin/CustomerType.php | 28 +-- .../doctrine/import_csv/ja/dtb_page.csv | 2 +- .../default/Mail/entry_complete.html.twig | 12 - .../template/default/Mail/entry_complete.twig | 11 - .../default/Mail/entry_confirm.html.twig | 28 +-- .../template/default/Mail/entry_confirm.twig | 19 -- src/Eccube/Service/MailService.php | 10 +- .../Eccube/Tests/Web/EntryControllerTest.php | 6 +- 11 files changed, 107 insertions(+), 238 deletions(-) diff --git a/codeception/acceptance/EF04CustomerCest.php b/codeception/acceptance/EF04CustomerCest.php index ff3eb7cca2d..aa12403f300 100644 --- a/codeception/acceptance/EF04CustomerCest.php +++ b/codeception/acceptance/EF04CustomerCest.php @@ -25,8 +25,6 @@ class EF04CustomerCest */ public function customer_会員登録正常(AcceptanceTester $I) { - $I->getScenario()->incomplete('4.2.0-betaではスキップ'); - $I->wantTo('EF0401-UC01-T01 会員登録 正常パターン'); $I->amOnPage('/entry'); $faker = Fixtures::get('faker'); @@ -52,7 +50,7 @@ public function customer_会員登録正常(AcceptanceTester $I) 'entry[user_policy_check]' => '1', ]; $findPluginByCode = Fixtures::get('findPluginByCode'); - $Plugin = $findPluginByCode('MailMagazine42'); + $Plugin = $findPluginByCode('MailMagazine'); if ($Plugin) { $I->amGoingTo('メルマガプラグインを発見したため、メルマガを購読します'); $form['entry[mailmaga_flg]'] = '1'; @@ -104,7 +102,6 @@ public function customer_会員登録正常(AcceptanceTester $I) public function customer_会員登録異常1(AcceptanceTester $I) { - $I->getScenario()->incomplete('4.2.0-betaではスキップ'); $I->wantTo('EF0401-UC01-T02 会員登録 異常パターン 重複'); $I->amOnPage('/entry'); diff --git a/src/Eccube/Controller/EntryController.php b/src/Eccube/Controller/EntryController.php index b8d0c2752fd..8a411d597ab 100644 --- a/src/Eccube/Controller/EntryController.php +++ b/src/Eccube/Controller/EntryController.php @@ -14,7 +14,6 @@ namespace Eccube\Controller; use Eccube\Entity\BaseInfo; -use Eccube\Entity\Customer; use Eccube\Entity\Master\CustomerStatus; use Eccube\Event\EccubeEvents; use Eccube\Event\EventArgs; @@ -169,57 +168,39 @@ public function index(Request $request) case 'complete': log_info('会員登録開始'); - $existCustomer = $this->customerRepository->findOneBy([ - 'email' => $Customer->getEmail(), - 'Status' => [ - CustomerStatus::PROVISIONAL, - CustomerStatus::REGULAR, - ] - ]); + $encoder = $this->encoderFactory->getEncoder($Customer); + $salt = $encoder->createSalt(); + $password = $encoder->encodePassword($Customer->getPlainPassword(), $salt); + $secretKey = $this->customerRepository->getUniqueSecretKey(); - if ($existCustomer) { - log_info('会員登録済のため登録処理をスキップ'); - } else { - log_info('会員登録を実行'); - - $encoder = $this->encoderFactory->getEncoder($Customer); - $salt = $encoder->createSalt(); - $password = $encoder->encodePassword($Customer->getPlainPassword(), $salt); - $secretKey = $this->customerRepository->getUniqueSecretKey(); - - $Customer - ->setSalt($salt) - ->setPassword($password) - ->setSecretKey($secretKey) - ->setPoint(0); - - $this->entityManager->persist($Customer); - $this->entityManager->flush(); - - log_info('会員登録完了'); - - $event = new EventArgs( - [ - 'form' => $form, - 'Customer' => $Customer, - ], - $request - ); - } + $Customer + ->setSalt($salt) + ->setPassword($password) + ->setSecretKey($secretKey) + ->setPoint(0); + + $this->entityManager->persist($Customer); + $this->entityManager->flush(); + log_info('会員登録完了'); + + $event = new EventArgs( + [ + 'form' => $form, + 'Customer' => $Customer, + ], + $request + ); $this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_ENTRY_INDEX_COMPLETE); - // 会員登録済の場合は既存のsecret_keyを利用 - $secretKey = $existCustomer ? $existCustomer->getSecretKey() : $Customer->getSecretKey(); + $activateFlg = $this->BaseInfo->isOptionCustomerActivate(); // 仮会員設定が有効な場合は、確認メールを送信し完了画面表示. - if ($this->BaseInfo->isOptionCustomerActivate()) { - log_info('仮会員設定が有効'); - - $activateUrl = $this->generateUrl('entry_activate', ['secret_key' => $secretKey], UrlGeneratorInterface::ABSOLUTE_URL); + if ($activateFlg) { + $activateUrl = $this->generateUrl('entry_activate', ['secret_key' => $Customer->getSecretKey()], UrlGeneratorInterface::ABSOLUTE_URL); // メール送信 - $this->mailService->sendCustomerConfirmMail($Customer, $activateUrl, $existCustomer); + $this->mailService->sendCustomerConfirmMail($Customer, $activateUrl); if ($event->hasResponse()) { return $event->getResponse(); @@ -229,31 +210,14 @@ public function index(Request $request) return $this->redirectToRoute('entry_complete'); } else { - log_info('仮会員設定が無効'); - - if ($existCustomer) { - // 会員登録済の場合はメール通知のみ - $this->mailService->sendCustomerCompleteMail($Customer, $existCustomer); - - log_info('会員登録完了画面へリダイレクト'); - - return $this->redirectToRoute('entry_activate_complete', [ - 'qtyInCart' => $this->getQuantityInCart(), - ]); - } else { - // 本会員として更新 - $this->updateRegularCustomer($Customer); - // ログイン済へ変更 - $this->doLogin($Customer, $request); - // メール通知 - $this->mailService->sendCustomerCompleteMail($Customer); - - log_info('会員登録完了画面へリダイレクト'); - - return $this->redirectToRoute('entry_activate_complete', [ - 'qtyInCart' => $this->getQuantityInCart(), - ]); - } + // 仮会員設定が無効な場合は、会員登録を完了させる. + $qtyInCart = $this->entryActivate($request, $Customer->getSecretKey()); + + // URLを変更するため完了画面にリダイレクト + return $this->redirectToRoute('entry_activate', [ + 'secret_key' => $Customer->getSecretKey(), + 'qtyInCart' => $qtyInCart, + ]); } } } @@ -264,7 +228,7 @@ public function index(Request $request) } /** - * 会員登録完了画面(仮会員). + * 会員登録完了画面. * * @Route("/entry/complete", name="entry_complete", methods={"GET"}) * @Template("Entry/complete.twig") @@ -277,9 +241,10 @@ public function complete() /** * 会員のアクティベート(本会員化)を行う. * - * @Route("/entry/activate/{secret_key}", name="entry_activate", methods={"GET"}) + * @Route("/entry/activate/{secret_key}/{qtyInCart}", name="entry_activate", methods={"GET"}) + * @Template("Entry/activate.twig") */ - public function activate(Request $request, $secret_key) + public function activate(Request $request, $secret_key, $qtyInCart = null) { $errors = $this->recursiveValidator->validate( $secret_key, @@ -293,83 +258,74 @@ public function activate(Request $request, $secret_key) ] ); - if (count($errors) === 0) { - $Customer = $this->customerRepository->getProvisionalCustomerBySecretKey($secret_key); - if (null === $Customer) { - throw new HttpException\NotFoundHttpException(); - } - - // 本会員として更新 - $this->updateRegularCustomer($Customer); - // ログイン済へ変更 - $this->doLogin($Customer, $request); - // メール通知 - $this->mailService->sendCustomerCompleteMail($Customer); - - return $this->redirectToRoute('entry_activate_complete', [ - 'qtyInCart' => $this->getQuantityInCart(), - ]); + if (!is_null($qtyInCart)) { + return [ + 'qtyInCart' => $qtyInCart, + ]; + } elseif ($request->getMethod() === 'GET' && count($errors) === 0) { + // 会員登録処理を行う + $qtyInCart = $this->entryActivate($request, $secret_key); + + return [ + 'qtyInCart' => $qtyInCart, + ]; } throw new HttpException\NotFoundHttpException(); } /** - * 会員登録完了画面(本会員). + * 会員登録処理を行う * - * @Route("/entry/activate_complete", name="entry_activate_complete", methods={"GET"}) - * @Template("Entry/activate.twig") - */ - public function activate_complete(Request $request) - { - return ['qtyInCart' => $request->query->get('qtyInCart')]; - } - - /** - * カート内の登録数を取得する. + * @param Request $request + * @param $secret_key * - * @return int + * @return \Eccube\Entity\Cart|mixed */ - private function getQuantityInCart(): int + private function entryActivate(Request $request, $secret_key) { + log_info('本会員登録開始'); + $Customer = $this->customerRepository->getProvisionalCustomerBySecretKey($secret_key); + if (is_null($Customer)) { + throw new HttpException\NotFoundHttpException(); + } + + $CustomerStatus = $this->customerStatusRepository->find(CustomerStatus::REGULAR); + $Customer->setStatus($CustomerStatus); + $this->entityManager->persist($Customer); + $this->entityManager->flush(); + + log_info('本会員登録完了'); + + $event = new EventArgs( + [ + 'Customer' => $Customer, + ], + $request + ); + $this->eventDispatcher->dispatch($event, EccubeEvents::FRONT_ENTRY_ACTIVATE_COMPLETE); + + // メール送信 + $this->mailService->sendCustomerCompleteMail($Customer); + + // Assign session carts into customer carts $Carts = $this->cartService->getCarts(); $qtyInCart = 0; foreach ($Carts as $Cart) { $qtyInCart += $Cart->getTotalQuantity(); } + // 本会員登録してログイン状態にする + $token = new UsernamePasswordToken($Customer, null, 'customer', ['ROLE_USER']); + $this->tokenStorage->setToken($token); + $request->getSession()->migrate(true); + if ($qtyInCart) { $this->cartService->save(); } - return $qtyInCart; - } - - /** - * ログイン状態に更新する. - * - * @param Customer $Customer - * @param Request $request - * @return void - */ - private function doLogin(Customer $Customer, Request $request): void - { - $token = new UsernamePasswordToken($Customer, null, 'customer', ['ROLE_USER']); - $this->tokenStorage->setToken($token); - $request->getSession()->migrate(true); - } + log_info('ログイン済に変更', [$this->getUser()->getId()]); - /** - * 本会員へ更新する. - * - * @param Customer $Customer - * @return void - */ - private function updateRegularCustomer(Customer $Customer): void - { - $CustomerStatus = $this->customerStatusRepository->find(CustomerStatus::REGULAR); - $Customer->setStatus($CustomerStatus); - $this->entityManager->persist($Customer); - $this->entityManager->flush(); + return $qtyInCart; } } diff --git a/src/Eccube/Entity/Customer.php b/src/Eccube/Entity/Customer.php index 92130d9e47d..bfe689e074e 100644 --- a/src/Eccube/Entity/Customer.php +++ b/src/Eccube/Entity/Customer.php @@ -332,6 +332,16 @@ public function eraseCredentials() { } + // TODO: できればFormTypeで行いたい + public static function loadValidatorMetadata(ClassMetadata $metadata) + { + $metadata->addConstraint(new UniqueEntity([ + 'fields' => 'email', + 'message' => 'form_error.customer_already_exists', + 'repositoryMethod' => 'getNonWithdrawingCustomers', + ])); + } + /** * Get id. * diff --git a/src/Eccube/Form/Type/Admin/CustomerType.php b/src/Eccube/Form/Type/Admin/CustomerType.php index 5b7a47783d3..3264020fdaa 100644 --- a/src/Eccube/Form/Type/Admin/CustomerType.php +++ b/src/Eccube/Form/Type/Admin/CustomerType.php @@ -25,7 +25,6 @@ use Eccube\Form\Type\PostalType; use Eccube\Form\Type\RepeatedPasswordType; use Eccube\Form\Validator\Email; -use Eccube\Repository\CustomerRepository; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\BirthdayType; use Symfony\Component\Form\Extension\Core\Type\EmailType; @@ -46,21 +45,14 @@ class CustomerType extends AbstractType */ protected $eccubeConfig; - /** - * @var CustomerRepository - */ - protected $customerRepository; - /** * CustomerType constructor. * * @param EccubeConfig $eccubeConfig - * @param CustomerRepository $customerRepository */ - public function __construct(EccubeConfig $eccubeConfig, CustomerRepository $customerRepository) + public function __construct(EccubeConfig $eccubeConfig) { $this->eccubeConfig = $eccubeConfig; - $this->customerRepository = $customerRepository; } /** @@ -158,24 +150,6 @@ public function buildForm(FormBuilderInterface $builder, array $options) ], ]); - $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { - $form = $event->getForm(); - /** @var Customer $Customer */ - $Customer = $event->getData(); - $qb = $this->customerRepository->createQueryBuilder('c'); - $qb->select('count(c.id)') - ->where('c.email = :email') - ->setParameter('email', $Customer->getEmail()); - if ($Customer->getId()) { - $qb->andWhere('c.id <> :id') - ->setParameter('id', $Customer->getId()); - } - $count = $qb->getQuery()->getSingleScalarResult(); - if ($count > 0) { - $form['email']->addError(new FormError(trans('form_error.customer_already_exists', [], 'validators'))); - } - }); - $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { $form = $event->getForm(); /** @var Customer $Customer */ diff --git a/src/Eccube/Resource/doctrine/import_csv/ja/dtb_page.csv b/src/Eccube/Resource/doctrine/import_csv/ja/dtb_page.csv index 5046f10f70a..9d19104c7ef 100644 --- a/src/Eccube/Resource/doctrine/import_csv/ja/dtb_page.csv +++ b/src/Eccube/Resource/doctrine/import_csv/ja/dtb_page.csv @@ -18,7 +18,7 @@ id,page_name,url,file_name,edit_type,author,description,keyword,create_date,upda "18","会員登録(入力ページ)","entry","Entry/index","2",,,,"2017-03-07 10:14:52","2017-03-07 10:14:52",,,"page", "20","会員登録(完了ページ)","entry_complete","Entry/complete","2",,,,"2017-03-07 10:14:52","2017-03-07 10:14:52","noindex",,"page", "21","特定商取引に関する法律に基づく表記","help_tradelaw","Help/tradelaw","2",,,,"2017-03-07 10:14:52","2017-03-07 10:14:52",,,"page", -"22","本会員登録(完了ページ)","entry_activate_complete","Entry/activate","2",,,,"2017-03-07 10:14:52","2017-03-07 10:14:52","noindex",,"page", +"22","本会員登録(完了ページ)","entry_activate","Entry/activate","2",,,,"2017-03-07 10:14:52","2017-03-07 10:14:52","noindex",,"page", "24","商品購入/お届け先の指定","shopping_shipping","Shopping/shipping","2",,,,"2017-03-07 10:14:52","2017-03-07 10:14:52","noindex",,"page", "28","商品購入/ご注文完了","shopping_complete","Shopping/complete","2",,,,"2017-03-07 10:14:52","2017-03-07 10:14:52","noindex",,"page", "29","プライバシーポリシー","help_privacy","Help/privacy","2",,,,"2017-03-07 10:14:52","2017-03-07 10:14:52",,,"page", diff --git a/src/Eccube/Resource/template/default/Mail/entry_complete.html.twig b/src/Eccube/Resource/template/default/Mail/entry_complete.html.twig index 1ccfec372b3..d1864f220ab 100644 --- a/src/Eccube/Resource/template/default/Mail/entry_complete.html.twig +++ b/src/Eccube/Resource/template/default/Mail/entry_complete.html.twig @@ -32,23 +32,11 @@ file that was distributed with this source code.
{{ BaseInfo.shop_name }}でございます。
この度は会員登録依頼をいただきましてまことに有り難うございます。
- {% if existCustomer is defined and existCustomer and existCustomer.status.id == constant('Eccube\\Entity\\Master\\CustomerStatus::REGULAR') %}{# 本会員登録済 #} - 入力いただきましたメールアドレスは、既に会員としてご登録いただいております。
- マイページよりログイン頂き、会員情報をご確認ください。
-
- {{ url('mypage') }}
-
- パスワードがわからない場合は、パスワードの再発行をご利用ください。
-
- {{ url('mypage') }}
-
- {% else %} ショッピングをお楽しみくださいませ。

今後ともどうぞ{{ BaseInfo.shop_name }}をよろしくお願い申し上げます。


- {% endif %} diff --git a/src/Eccube/Resource/template/default/Mail/entry_complete.twig b/src/Eccube/Resource/template/default/Mail/entry_complete.twig index 066b20d62be..fb53e87da33 100644 --- a/src/Eccube/Resource/template/default/Mail/entry_complete.twig +++ b/src/Eccube/Resource/template/default/Mail/entry_complete.twig @@ -26,19 +26,8 @@ file that was distributed with this source code. この度は会員登録依頼をいただきましてまことに有り難うございます。 -{% if existCustomer is defined and existCustomer and existCustomer.status.id == constant('Eccube\\Entity\\Master\\CustomerStatus::REGULAR') %}{# 本会員登録済 #} -入力いただきましたメールアドレスは、既に会員としてご登録いただいております。 -マイページよりログイン頂き、会員情報をご確認ください。 - -{{ url('mypage') }} - -パスワードがわからない場合は、パスワードの再発行をご利用ください。 - -{{ url('forgot') }} -{% else %} 本会員登録が完了いたしました。 ショッピングをお楽しみくださいませ。 今後ともどうぞ{{ BaseInfo.shop_name }}をよろしくお願い申し上げます。 -{% endif %} {% endautoescape %} diff --git a/src/Eccube/Resource/template/default/Mail/entry_confirm.html.twig b/src/Eccube/Resource/template/default/Mail/entry_confirm.html.twig index 54d4fbc23a7..32f2f53b393 100644 --- a/src/Eccube/Resource/template/default/Mail/entry_confirm.html.twig +++ b/src/Eccube/Resource/template/default/Mail/entry_confirm.html.twig @@ -31,34 +31,14 @@ file that was distributed with this source code. {{ Customer.name01 }} {{ Customer.name02 }} 様

{{ BaseInfo.shop_name }}でございます。
- {% if existCustomer is defined and existCustomer and existCustomer.status.id == constant('Eccube\\Entity\\Master\\CustomerStatus::PROVISIONAL') %}{# 仮会員登録済 #} - 入力いただきましたメールアドレスは、現在仮登録の状態です。
- 本会員登録を完了するには下記URLにアクセスしてください。
+ 現在は仮登録の状態です。

+ 本会員登録を完了するには下記URLにアクセスしてください。

+ {{ activateUrl }}
- {{ activateUrl }}

- 上記URLにて本会員登録が完了いたしましたら改めてご登録内容ご確認メールをお送り致します。
+ 上記URLにて本会員登録が完了いたしましたら改めてご登録内容ご確認メールをお送り致します。
- {% elseif existCustomer is defined and existCustomer and existCustomer.status.id == constant('Eccube\\Entity\\Master\\CustomerStatus::REGULAR') %}{# 本会員登録済 #} - 入力いただきましたメールアドレスは、既に会員としてご登録いただいております。
- マイページよりログイン頂き、会員情報をご確認ください。

- {{ url('mypage') }}
-
- パスワードがわからない場合は、パスワードの再発行をご利用ください。
-
- {{ url('mypage') }}
-
- {% else %} - 現在は仮登録の状態です。
-
- 本会員登録を完了するには下記URLにアクセスしてください。
-
- {{ activateUrl }}
-
- 上記URLにて本会員登録が完了いたしましたら改めてご登録内容ご確認メールをお送り致します。
-
- {% endif %} diff --git a/src/Eccube/Resource/template/default/Mail/entry_confirm.twig b/src/Eccube/Resource/template/default/Mail/entry_confirm.twig index 07b0348bdb8..b4cdc738324 100644 --- a/src/Eccube/Resource/template/default/Mail/entry_confirm.twig +++ b/src/Eccube/Resource/template/default/Mail/entry_confirm.twig @@ -27,24 +27,6 @@ file that was distributed with this source code. この度は会員登録依頼をいただきまして、有り難うございます。 -{% if existCustomer is defined and existCustomer and existCustomer.status.id == constant('Eccube\\Entity\\Master\\CustomerStatus::PROVISIONAL') %}{# 仮会員登録済 #} -入力いただきましたメールアドレスは、現在仮登録の状態です。 -本会員登録を完了するには下記URLにアクセスしてください。 - -{{ activateUrl }} - -上記URLにて本会員登録が完了いたしましたら改めてご登録内容ご確認 -メールをお送り致します。 -{% elseif existCustomer is defined and existCustomer and existCustomer.status.id == constant('Eccube\\Entity\\Master\\CustomerStatus::REGULAR') %}{# 本会員登録済 #} -入力いただきましたメールアドレスは、既に会員としてご登録いただいております。 -マイページよりログイン頂き、会員情報をご確認ください。 - -{{ url('mypage') }} - -パスワードがわからない場合は、パスワードの再発行をご利用ください。 - -{{ url('forgot') }} -{% else %} 現在は仮登録の状態です。    ~~~~~~ 本会員登録を完了するには下記URLにアクセスしてください。 @@ -53,5 +35,4 @@ file that was distributed with this source code. 上記URLにて本会員登録が完了いたしましたら改めてご登録内容ご確認 メールをお送り致します。 -{% endif %} {% endautoescape %} diff --git a/src/Eccube/Service/MailService.php b/src/Eccube/Service/MailService.php index f429a767686..9f5182cb081 100644 --- a/src/Eccube/Service/MailService.php +++ b/src/Eccube/Service/MailService.php @@ -110,9 +110,8 @@ public function __construct( * * @param $Customer 会員情報 * @param string $activateUrl アクティベート用url - * @param Customer $existCustomer */ - public function sendCustomerConfirmMail(Customer $Customer, $activateUrl, Customer $existCustomer = null) + public function sendCustomerConfirmMail(Customer $Customer, $activateUrl) { log_info('仮会員登録メール送信開始'); @@ -122,7 +121,6 @@ public function sendCustomerConfirmMail(Customer $Customer, $activateUrl, Custom 'Customer' => $Customer, 'BaseInfo' => $this->BaseInfo, 'activateUrl' => $activateUrl, - 'existCustomer' => $existCustomer, ]); $message = (new Email()) @@ -140,7 +138,6 @@ public function sendCustomerConfirmMail(Customer $Customer, $activateUrl, Custom 'Customer' => $Customer, 'BaseInfo' => $this->BaseInfo, 'activateUrl' => $activateUrl, - 'existCustomer' => $existCustomer, ]); $message @@ -172,9 +169,8 @@ public function sendCustomerConfirmMail(Customer $Customer, $activateUrl, Custom * Send customer complete mail. * * @param $Customer 会員情報 - * @param Customer $existCustomer */ - public function sendCustomerCompleteMail(Customer $Customer, Customer $existCustomer = null) + public function sendCustomerCompleteMail(Customer $Customer) { log_info('会員登録完了メール送信開始'); @@ -182,7 +178,6 @@ public function sendCustomerCompleteMail(Customer $Customer, Customer $existCust $body = $this->twig->render($MailTemplate->getFileName(), [ 'Customer' => $Customer, - 'existCustomer' => $existCustomer, 'BaseInfo' => $this->BaseInfo, ]); @@ -199,7 +194,6 @@ public function sendCustomerCompleteMail(Customer $Customer, Customer $existCust if (!is_null($htmlFileName)) { $htmlBody = $this->twig->render($htmlFileName, [ 'Customer' => $Customer, - 'existCustomer' => $existCustomer, 'BaseInfo' => $this->BaseInfo, ]); diff --git a/tests/Eccube/Tests/Web/EntryControllerTest.php b/tests/Eccube/Tests/Web/EntryControllerTest.php index c41e5e88a09..00c218c25cb 100644 --- a/tests/Eccube/Tests/Web/EntryControllerTest.php +++ b/tests/Eccube/Tests/Web/EntryControllerTest.php @@ -210,14 +210,14 @@ public function testActivate() $BaseInfo = $this->entityManager->getRepository(\Eccube\Entity\BaseInfo::class)->get(); $Customer = $this->createCustomer(); $secret_key = $Customer->getSecretKey(); - $Status = $this->entityManager->getRepository('Eccube\Entity\Master\CustomerStatus')->find(CustomerStatus::PROVISIONAL); + $Status = $this->entityManager->getRepository('Eccube\Entity\Master\CustomerStatus')->find(CustomerStatus::NONACTIVE); $Customer->setStatus($Status); $this->entityManager->flush(); $client = $this->client; $client->request('GET', $this->generateUrl('entry_activate', ['secret_key' => $secret_key])); - $this->assertTrue($client->getResponse()->isRedirection()); + $this->assertTrue($client->getResponse()->isSuccessful()); $this->assertEmailCount(1); /** @var Email $Message */ $Message = $this->getMailerMessage(0); @@ -239,7 +239,7 @@ public function testActivateWithSanitize() $client = $this->client; $client->request('GET', $this->generateUrl('entry_activate', ['secret_key' => $secret_key])); - $this->assertTrue($client->getResponse()->isRedirection()); + $this->assertTrue($client->getResponse()->isSuccessful()); $this->assertEmailCount(1); /** @var Email $Message */ $Message = $this->getMailerMessage(0); From 2506fafbcc4edc7a2646328116c3f6d68cf09926 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Mon, 25 Jul 2022 10:22:59 +0900 Subject: [PATCH 2/3] Update codeception/acceptance/EF04CustomerCest.php --- codeception/acceptance/EF04CustomerCest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codeception/acceptance/EF04CustomerCest.php b/codeception/acceptance/EF04CustomerCest.php index aa12403f300..f8c986de9a3 100644 --- a/codeception/acceptance/EF04CustomerCest.php +++ b/codeception/acceptance/EF04CustomerCest.php @@ -50,7 +50,7 @@ public function customer_会員登録正常(AcceptanceTester $I) 'entry[user_policy_check]' => '1', ]; $findPluginByCode = Fixtures::get('findPluginByCode'); - $Plugin = $findPluginByCode('MailMagazine'); + $Plugin = $findPluginByCode('MailMagazine42'); if ($Plugin) { $I->amGoingTo('メルマガプラグインを発見したため、メルマガを購読します'); $form['entry[mailmaga_flg]'] = '1'; From 650be08895c73ce4ab281f20ca1ffe81c320ba54 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Mon, 25 Jul 2022 11:22:14 +0900 Subject: [PATCH 3/3] Add use --- src/Eccube/Entity/Customer.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Eccube/Entity/Customer.php b/src/Eccube/Entity/Customer.php index 26bdf95a6d4..611414b58d4 100644 --- a/src/Eccube/Entity/Customer.php +++ b/src/Eccube/Entity/Customer.php @@ -14,8 +14,10 @@ namespace Eccube\Entity; use Doctrine\ORM\Mapping as ORM; +use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Validator\Constraints as Assert; +use Symfony\Component\Validator\Mapping\ClassMetadata; if (!class_exists('\Eccube\Entity\Customer')) { /**