31 private $cookieMetadataFactory;
36 private $cookieMetadataManager;
46 $this->session = $customerSession;
47 parent::__construct($context);
56 private function getCookieManager()
58 if (!$this->cookieMetadataManager) {
61 return $this->cookieMetadataManager;
70 private function getCookieMetadataFactory()
72 if (!$this->cookieMetadataFactory) {
75 return $this->cookieMetadataFactory;
85 $lastCustomerId = $this->session->getId();
86 $this->session->logout()->setBeforeAuthUrl($this->
_redirect->getRefererUrl())
87 ->setLastCustomerId($lastCustomerId);
88 if ($this->getCookieManager()->getCookie(
'mage-cache-sessid')) {
89 $metadata = $this->getCookieMetadataFactory()->createCookieMetadata();
90 $metadata->setPath(
'/');
91 $this->getCookieManager()->deleteCookie(
'mage-cache-sessid', $metadata);
95 $resultRedirect = $this->resultRedirectFactory->create();
96 $resultRedirect->setPath(
'*/*/logoutSuccess');
97 return $resultRedirect;
_redirect($path, $arguments=[])
__construct(Context $context, Session $customerSession)