customerRegistry = $customerRegistry; $this->customerResourceModel = $customerResourceModel; $this->customerModel = $customerModel ?: ObjectManager::getInstance()->get(Customer::class); } /** * Reset Authentication data for customer. * * @param int $customerId * @return $this * @throws NoSuchEntityException */ public function saveAuth($customerId) { $customerSecure = $this->customerRegistry->retrieveSecureData($customerId); $this->customerResourceModel->load($this->customerModel, $customerId); $currentLockExpiresVal = $this->customerModel->getData('lock_expires'); $newLockExpiresVal = $customerSecure->getData('lock_expires'); $this->customerResourceModel->getConnection()->update( $this->customerResourceModel->getTable('customer_entity'), [ 'failures_num' => $customerSecure->getData('failures_num'), 'first_failure' => $customerSecure->getData('first_failure'), 'lock_expires' => $newLockExpiresVal, ], $this->customerResourceModel->getConnection()->quoteInto('entity_id = ?', $customerId) ); if ($currentLockExpiresVal !== $newLockExpiresVal) { $this->customerModel->reindex(); } return $this; } }