Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/magento/module-customer/Model/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-customer/Model/CustomerAuthUpdate.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento\Customer\Model;

use Magento\Customer\Model\ResourceModel\Customer as CustomerResourceModel;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\NoSuchEntityException;

/**
 * Customer Authentication update model.
 */
class CustomerAuthUpdate
{
    /**
     * @var CustomerRegistry
     */
    protected $customerRegistry;

    /**
     * @var CustomerResourceModel
     */
    protected $customerResourceModel;

    /**
     * @var Customer
     */
    private $customerModel;

    /**
     * @param CustomerRegistry $customerRegistry
     * @param CustomerResourceModel $customerResourceModel
     * @param Customer|null $customerModel
     */
    public function __construct(
        CustomerRegistry $customerRegistry,
        CustomerResourceModel $customerResourceModel,
        Customer $customerModel = null
    ) {
        $this->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;
    }
}

Spamworldpro Mini