Skip to content

Commit bbc54f6

Browse files
committed
MAGE-891: Change authentication token duration to the Magento default one
1 parent 537c32b commit bbc54f6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Helper/ConfigHelper.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class ConfigHelper
8181
public const CC_ANALYTICS_IS_SELECTOR = 'algoliasearch_cc_analytics/cc_analytics_group/is_selector';
8282
public const CC_CONVERSION_ANALYTICS_MODE = 'algoliasearch_cc_analytics/cc_analytics_group/conversion_analytics_mode';
8383
public const CC_ADD_TO_CART_SELECTOR = 'algoliasearch_cc_analytics/cc_analytics_group/add_to_cart_selector';
84+
public const COOKIE_LIFETIME = 'web/cookie/cookie_lifetime';
8485

8586
public const GA_ENABLE = 'algoliasearch_analytics/analytics_group/enable';
8687
public const GA_DELAY = 'algoliasearch_analytics/analytics_group/delay';
@@ -141,7 +142,7 @@ class ConfigHelper
141142
protected const IS_LOOKING_SIMILAR_ENABLED_IN_PDP = 'algoliasearch_recommend/recommend/looking_similar/is_looking_similar_enabled_on_pdp';
142143
protected const IS_LOOKING_SIMILAR_ENABLED_IN_SHOPPING_CART = 'algoliasearch_recommend/recommend/looking_similar/is_looking_similar_enabled_on_cart_page';
143144
protected const LOOKING_SIMILAR_TITLE = 'algoliasearch_recommend/recommend/looking_similar/title';
144-
public const LEGACY_USE_VIRTUAL_REPLICA_ENABLED = 'algoliasearch_instant/instant/use_virtual_replica';
145+
public const LEGACY_USE_VIRTUAL_REPLICA_ENABLED = 'algoliasearch_instant/instant/use_virtual_replica';
145146
protected const AUTOCOMPLETE_KEYBORAD_NAVIAGATION = 'algoliasearch_autocomplete/autocomplete/navigator';
146147
protected const FREQUENTLY_BOUGHT_TOGETHER_TITLE = 'algoliasearch_recommend/recommend/frequently_bought_together/title';
147148
protected const RELATED_PRODUCTS_TITLE = 'algoliasearch_recommend/recommend/related_product/title';
@@ -1856,4 +1857,13 @@ public function isCookieRestrictionModeEnabled()
18561857
{
18571858
return (bool)$this->cookieHelper->isCookieRestrictionModeEnabled();
18581859
}
1860+
1861+
/**
1862+
* @param $storeId
1863+
* @return mixed
1864+
*/
1865+
public function getCookieLifetime($storeId = null)
1866+
{
1867+
return $this->configInterface->getValue(self::COOKIE_LIFETIME, ScopeInterface::SCOPE_STORE, $storeId);
1868+
}
18591869
}

Helper/InsightsHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function setAuthenticatedUserToken(Customer $customer): string|null
142142
$userToken = $this->generateAuthenticatedUserToken($customer);
143143

144144
$metaData = $this->cookieMetadataFactory->createPublicCookieMetadata()
145-
->setDurationOneYear()
145+
->setDuration($this->configHelper->getCookieLifetime())
146146
->setPath('/')
147147
->setHttpOnly(false)
148148
->setSecure(false);

0 commit comments

Comments
 (0)