Skip to content

Commit fd6a589

Browse files
authored
Update CustomerLogout.php
1 parent fa73824 commit fd6a589

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Observer/Insights/CustomerLogout.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
class CustomerLogout implements ObserverInterface
1111
{
12+
public const UNSET_AUTHENTICATION_USER_TOKEN_COOKIE_NAME = "unset_authentication_token";
1213
/**
1314
* @var PhpCookieManager
1415
*/
@@ -42,9 +43,15 @@ public function __construct(
4243
public function execute(\Magento\Framework\Event\Observer $observer)
4344
{
4445
if ($this->cookieManager->getCookie(InsightsHelper::ALGOLIA_CUSTOMER_USER_TOKEN_COOKIE_NAME)) {
46+
$metaDataUnset = $this->cookieMetadataFactory->createPublicCookieMetadata()
47+
->setDurationOneYear()
48+
->setPath('/')
49+
->setHttpOnly(false)
50+
->setSecure(false);
51+
$this->cookieManager->setPublicCookie(self::UNSET_AUTHENTICATION_USER_TOKEN_COOKIE_NAME, 1, $metaDataUnset);
4552
$metadata = $this->cookieMetadataFactory->createCookieMetadata();
4653
$metadata->setPath('/');
4754
$this->cookieManager->deleteCookie(InsightsHelper::ALGOLIA_CUSTOMER_USER_TOKEN_COOKIE_NAME, $metadata);
4855
}
4956
}
50-
}
57+
}

0 commit comments

Comments
 (0)