Skip to content

Commit ec3f4de

Browse files
authored
BB-21684: Refactor Customer Visitors functionality (#40389)
- implement a possibility to use anonymous customer visitors in API
1 parent 9e88b04 commit ec3f4de

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

Diff for: bundles/commerce/CustomerBundle/index.rst

+3-12
Original file line numberDiff line numberDiff line change
@@ -130,20 +130,11 @@ By default, this param is 30 days, and it is accessible through the :ref:`System
130130
.. code-block:: php
131131
132132
133-
const COOKIE_ATTR_NAME = '_security_customer_visitor_cookie';
134-
const COOKIE_NAME = 'customer_visitor';
135-
136-
$cookieLifetime = $this->configManager->get('oro_customer.customer_visitor_cookie_lifetime_days');
137-
138-
$cookieLifetime = $cookieLifetime * Configuration::SECONDS_IN_DAY;
133+
// $cookieFactory is an instance of Oro\Bundle\CustomerBundle\Security\Firewall\CustomerVisitorCookieFactory
139134
140135
$request->attributes->set(
141-
self::COOKIE_ATTR_NAME,
142-
new Cookie(
143-
self::COOKIE_NAME,
144-
base64_encode(json_encode([$visitor->getId(), $visitor->getSessionId()])),
145-
time() + $cookieLifetime
146-
)
136+
AnonymousCustomerUserAuthenticator::COOKIE_ATTR_NAME,
137+
$cookieFactory->getCookie($visitor->getSessionId())
147138
);
148139
149140

0 commit comments

Comments
 (0)