Skip to content

Commit

Permalink
Remove Zend_Json from the persistent module remember me status observer
Browse files Browse the repository at this point in the history
  • Loading branch information
dmanners committed Feb 28, 2017
1 parent 8844ce3 commit 0fdf245
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,27 @@ class SetRememberMeStatusForAjaxLoginObserver implements ObserverInterface
protected $_persistentData = null;

/**
* Constructor
* @var \Magento\Framework\Serialize\Serializer\Json
*/
private $serializer;

/**
* SetRememberMeStatusForAjaxLoginObserver constructor.
*
* @param \Magento\Persistent\Helper\Data $persistentData
* @param \Magento\Persistent\Helper\Session $persistentSession
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
* @throws \RuntimeException
*/
public function __construct(
\Magento\Persistent\Helper\Data $persistentData,
\Magento\Persistent\Helper\Session $persistentSession
\Magento\Persistent\Helper\Session $persistentSession,
\Magento\Framework\Serialize\Serializer\Json $serializer = null
) {
$this->_persistentData = $persistentData;
$this->_persistentSession = $persistentSession;
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Serialize\Serializer\Json::class);
}

/**
Expand All @@ -63,7 +73,7 @@ public function execute(Observer $observer)
$requestData = [];
$content = $request->getContent();
if ($content) {
$requestData = \Zend_Json::decode($content);
$requestData = $this->serializer->unserialize($content);
}
$isRememberMeChecked = empty($requestData['persistent_remember_me']) ? false : true;
$this->_persistentSession->setRememberMeChecked((bool)$isRememberMeChecked);
Expand Down

0 comments on commit 0fdf245

Please sign in to comment.