67 private $cookieMetadataFactory;
72 private $cookieMetadataManager;
94 $this->session = $customerSession;
100 $this->urlModel = $urlFactory->
create();
101 parent::__construct($context);
110 private function getCookieManager()
112 if (!$this->cookieMetadataManager) {
114 \
Magento\Framework\Stdlib\Cookie\PhpCookieManager::class
117 return $this->cookieMetadataManager;
126 private function getCookieMetadataFactory()
128 if (!$this->cookieMetadataFactory) {
130 \
Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class
133 return $this->cookieMetadataFactory;
146 if ($this->session->isLoggedIn()) {
147 $resultRedirect->setPath(
'*/*/');
148 return $resultRedirect;
152 $key = $this->
getRequest()->getParam(
'key',
false);
154 throw new \Exception(
__(
'Bad request.'));
160 $this->session->setCustomerDataAsLoggedIn(
$customer);
161 if ($this->getCookieManager()->getCookie(
'mage-cache-sessid')) {
162 $metadata = $this->getCookieMetadataFactory()->createCookieMetadata();
163 $metadata->setPath(
'/');
164 $this->getCookieManager()->deleteCookie(
'mage-cache-sessid', $metadata);
168 return $resultRedirect;
169 }
catch (StateException $e) {
170 $this->messageManager->addException($e,
__(
'This confirmation key is invalid or has expired.'));
171 }
catch (\Exception $e) {
172 $this->messageManager->addException($e,
__(
'There was an error confirming the account'));
175 $url = $this->urlModel->getUrl(
'*/*/index', [
'_secure' =>
true]);
176 return $resultRedirect->setUrl($this->
_redirect->error(
$url));
186 if ($this->addressHelper->isVatValidationEnabled()) {
190 'If you are a registered VAT customer, please click <a href="%1">here</a> to enter your shipping address for proper VAT calculation.',
191 $this->urlModel->getUrl(
'customer/address/edit')
197 'If you are a registered VAT customer, please click <a href="%1">here</a> to enter your billing address for proper VAT calculation.',
198 $this->urlModel->getUrl(
'customer/address/edit')
203 $message =
__(
'Thank you for registering with %1.', $this->storeManager->getStore()->getFrontendName());
215 $backUrl = $this->
getRequest()->getParam(
'back_url',
false);
216 $redirectToDashboard = $this->scopeConfig->isSetFlag(
220 if (!$redirectToDashboard && $this->session->getBeforeAuthUrl()) {
221 $successUrl = $this->session->getBeforeAuthUrl(
true);
223 $successUrl = $this->urlModel->getUrl(
'*/*/index', [
'_secure' =>
true]);
225 return $this->
_redirect->success($backUrl ? $backUrl : $successUrl);
_redirect($path, $arguments=[])
const XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD
$customerAccountManagement
__construct(Context $context, Session $customerSession, ScopeConfigInterface $scopeConfig, StoreManagerInterface $storeManager, AccountManagementInterface $customerAccountManagement, CustomerRepositoryInterface $customerRepository, Address $addressHelper, UrlFactory $urlFactory)