当前位置: 首页>>代码示例>>PHP>>正文


PHP AccountManagementInterface::resendConfirmation方法代码示例

本文整理汇总了PHP中Magento\Customer\Api\AccountManagementInterface::resendConfirmation方法的典型用法代码示例。如果您正苦于以下问题:PHP AccountManagementInterface::resendConfirmation方法的具体用法?PHP AccountManagementInterface::resendConfirmation怎么用?PHP AccountManagementInterface::resendConfirmation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Customer\Api\AccountManagementInterface的用法示例。


在下文中一共展示了AccountManagementInterface::resendConfirmation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Send confirmation link to specified email
  *
  * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\View\Result\Page
  */
 public function execute()
 {
     if ($this->session->isLoggedIn()) {
         /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultRedirectFactory->create();
         $resultRedirect->setPath('*/*/');
         return $resultRedirect;
     }
     // try to confirm by email
     $email = $this->getRequest()->getPost('email');
     if ($email) {
         /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultRedirectFactory->create();
         try {
             $this->customerAccountManagement->resendConfirmation($email, $this->storeManager->getStore()->getWebsiteId());
             $this->messageManager->addSuccess(__('Please check your email for confirmation key.'));
         } catch (InvalidTransitionException $e) {
             $this->messageManager->addSuccess(__('This email does not require confirmation.'));
         } catch (\Exception $e) {
             $this->messageManager->addException($e, __('Wrong email.'));
             $resultRedirect->setPath('*/*/*', ['email' => $email, '_secure' => true]);
             return $resultRedirect;
         }
         $this->session->setUsername($email);
         $resultRedirect->setPath('*/*/index', ['_secure' => true]);
         return $resultRedirect;
     }
     /** @var \Magento\Framework\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->getLayout()->getBlock('accountConfirmation')->setEmail($this->getRequest()->getParam('email', $email));
     return $resultPage;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:37,代码来源:Confirmation.php

示例2: testResendConfirmationNotNeeded

 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException
  */
 public function testResendConfirmationNotNeeded()
 {
     $this->accountManagement->resendConfirmation('customer@example.com', 1);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:8,代码来源:AccountManagementTest.php


注:本文中的Magento\Customer\Api\AccountManagementInterface::resendConfirmation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。