| Current Path : /home/rtorresani/www/vendor/magento/module-customer/Observer/ |
| Current File : //home/rtorresani/www/vendor/magento/module-customer/Observer/CustomerLoginSuccessObserver.php |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Customer\Observer;
use Magento\Customer\Model\AuthenticationInterface;
use Magento\Framework\Event\ObserverInterface;
/**
* Class CustomerLoginSuccessObserver
*/
class CustomerLoginSuccessObserver implements ObserverInterface
{
/**
* Authentication
*
* @var AuthenticationInterface
*/
protected $authentication;
/**
* @param AuthenticationInterface $authentication
*/
public function __construct(
AuthenticationInterface $authentication
) {
$this->authentication = $authentication;
}
/**
* Unlock customer on success login attempt.
* @param \Magento\Framework\Event\Observer $observer
* @return $this
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
/** @var \Magento\Customer\Model\Customer $customer */
$customer = $observer->getEvent()->getData('model');
$this->authentication->unlock($customer->getId());
return $this;
}
}