Skip to content

Instantly share code, notes, and snippets.

@williankeller
Last active July 12, 2018 19:04
Show Gist options
  • Save williankeller/4cbc5bda169d78f7b447dae201d15ad1 to your computer and use it in GitHub Desktop.
Save williankeller/4cbc5bda169d78f7b447dae201d15ad1 to your computer and use it in GitHub Desktop.
<?php
class Account {
/**
* {@inheritdoc}
*/
public function isCustomerBlocked($return = false)
{
if ($this->helper->isBlockedActive() && $this->customerSession->getIsCustomerBlocked() == 1) {
// Close session to recreate the login.
$this->customerSession->logout();
$this->customerSession->start();
$this->messageManager->addError($this->helper->blockedMessage());
$url = $this->helper->blockedRedirect();
$redirect = $this->url->getUrl($url);
$response = $this->response->setRedirect($redirect)->sendResponse();
// Stop process.
if ($return) {
return $response;
}
exit;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment