149 \
Magento\Framework\UrlFactory $urlFactory,
157 $this->_coreUrl = $coreUrl;
159 $this->_configShare = $configShare;
160 $this->_customerResource = $customerResource;
162 $this->_urlFactory = $urlFactory;
165 $this->_eventManager = $eventManager;
166 $this->_httpContext = $httpContext;
180 $this->_eventManager->dispatch(
'customer_session_init', [
'customer_session' => $this]);
205 $this->_httpContext->setValue(
222 if (!$this->_customer instanceof CustomerData && $this->
getCustomerId()) {
223 $this->_customer = $this->customerRepository->getById($this->
getCustomerId());
248 $this->
setId($customerData->getId());
262 $this->_customerModel = $customerModel;
263 $this->_httpContext->setValue(
270 $customerModel->setConfirmation(
null)->
save();
277 $this->unsIsCustomerEmulated();
290 if ($this->_customerModel ===
null) {
291 $this->_customerModel = $this->_customerFactory->create()->load($this->
getCustomerId());
305 $this->storage->setData(
'customer_id',
$id);
317 if ($this->storage->getData(
'customer_id')) {
318 return $this->storage->getData(
'customer_id');
352 $this->storage->setData(
'customer_group_id',
$id);
364 if ($this->storage->getData(
'customer_group_id')) {
365 return $this->storage->getData(
'customer_group_id');
370 return $customerGroupId;
385 && !$this->getIsCustomerEmulated();
404 }
catch (\Exception $e) {
416 $this->_eventManager->dispatch(
'customer_login', [
'customer' =>
$customer]);
417 $this->_eventManager->dispatch(
'customer_data_object_login', [
'customer' => $this->
getCustomerDataObject()]);
431 $customerModel = $this->_customerFactory->create()->updateData(
$customer);
435 $this->_eventManager->dispatch(
'customer_login', [
'customer' => $customerModel]);
436 $this->_eventManager->dispatch(
'customer_data_object_login', [
'customer' =>
$customer]);
453 }
catch (\Exception $e) {
467 $this->_eventManager->dispatch(
'customer_logout', [
'customer' => $this->
getCustomer()]);
486 if (isset($loginUrl)) {
487 $this->response->setRedirect($loginUrl);
489 $arguments = $this->_customerUrl->getLoginUrlParams();
493 $this->sidResolver->getSessionIdQueryParam($this->_session) => $this->_session->getSessionId(),
497 $this->response->setRedirect(
514 $url = $this->_coreUrl->removeRequestParam(
$url, $this->sidResolver->getSessionIdQueryParam($this));
517 return $this->storage->setData($key,
$url);
527 $this->_customer =
null;
528 $this->_customerModel =
null;
531 $this->
destroy([
'clear_storage' =>
false]);
564 parent::regenerateId();
574 return $this->_urlFactory->create();
checkCustomerId($customerId)
setCustomerData(CustomerData $customer)
setCustomer(Customer $customerModel)
const ROUTE_ACCOUNT_LOGIN
setCustomerDataAsLoggedIn($customer)
setCustomerDataObject(CustomerData $customerData)
authenticate($loginUrl=null)
destroy(array $options=null)
__construct(\Magento\Framework\App\Request\Http $request, \Magento\Framework\Session\SidResolverInterface $sidResolver, \Magento\Framework\Session\Config\ConfigInterface $sessionConfig, \Magento\Framework\Session\SaveHandlerInterface $saveHandler, \Magento\Framework\Session\ValidatorInterface $validator, \Magento\Framework\Session\StorageInterface $storage, \Magento\Framework\Stdlib\CookieManagerInterface $cookieManager, \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory $cookieMetadataFactory, \Magento\Framework\App\State $appState, Config\Share $configShare, \Magento\Framework\Url\Helper\Data $coreUrl, \Magento\Customer\Model\Url $customerUrl, ResourceCustomer $customerResource, CustomerFactory $customerFactory, \Magento\Framework\UrlFactory $urlFactory, \Magento\Framework\Session\Generic $session, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Framework\App\Http\Context $httpContext, CustomerRepositoryInterface $customerRepository, GroupManagementInterface $groupManagement, \Magento\Framework\App\Response\Http $response)
setCustomerAsLoggedIn($customer)