Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AccountConfirmation.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Customer\Model;
7 
11 
17 {
21  const XML_PATH_IS_CONFIRM = 'customer/create_account/confirm';
22 
26  private $scopeConfig;
27 
31  private $registry;
32 
37  public function __construct(
38  ScopeConfigInterface $scopeConfig,
39  Registry $registry
40  ) {
41  $this->scopeConfig = $scopeConfig;
42  $this->registry = $registry;
43  }
44 
54  {
55  if ($this->canSkipConfirmation($customerId, $customerEmail)) {
56  return false;
57  }
58 
59  return (bool)$this->scopeConfig->getValue(
60  self::XML_PATH_IS_CONFIRM,
61  ScopeInterface::SCOPE_WEBSITES,
63  );
64  }
65 
73  private function canSkipConfirmation($customerId, $customerEmail): bool
74  {
75  if (!$customerId) {
76  return false;
77  }
78 
79  /* If an email was used to start the registration process and it is the same email as the one
80  used to register, then this can skip confirmation.
81  */
82  $skipConfirmationIfEmail = $this->registry->registry("skip_confirmation_if_email");
83  if (!$skipConfirmationIfEmail) {
84  return false;
85  }
86 
87  return strtolower($skipConfirmationIfEmail) === strtolower($customerEmail);
88  }
89 }
isConfirmationRequired($websiteId, $customerId, $customerEmail)
__construct(ScopeConfigInterface $scopeConfig, Registry $registry)