Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Unlock.php
Go to the documentation of this file.
1 <?php
8 
12 
17 {
23  const ADMIN_RESOURCE = 'Magento_Customer::manage';
24 
30  protected $authentication;
31 
38  public function __construct(
39  Action\Context $context,
41  ) {
42  parent::__construct($context);
43  $this->authentication = $authentication;
44  }
45 
51  public function execute()
52  {
53  $customerId = $this->getRequest()->getParam('customer_id');
54  try {
55  // unlock customer
56  if ($customerId) {
57  $this->authentication->unlock($customerId);
58  $this->getMessageManager()->addSuccess(__('Customer has been unlocked successfully.'));
59  }
60  } catch (\Exception $e) {
61  $this->messageManager->addError($e->getMessage());
62  }
63 
65  $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
66  return $resultRedirect->setPath(
67  'customer/index/edit',
68  ['id' => $customerId]
69  );
70  }
71 }
__construct(Action\Context $context, AuthenticationInterface $authentication)
Definition: Unlock.php:38
__()
Definition: __.php:13