/** * Prepare redirect URL * * @return void */ protected function prepareRedirectUrl() { $baseUrl = $this->storeManager->getStore()->getBaseUrl(); $url = $this->session->getBeforeAuthUrl(); if (!$url) { $url = $baseUrl; } switch ($url) { case $baseUrl: if ($this->session->isLoggedIn()) { $this->processLoggedCustomer(); } else { $this->applyRedirect($this->customerUrl->getLoginUrl()); } break; case $this->customerUrl->getLogoutUrl(): $this->applyRedirect($this->customerUrl->getDashboardUrl()); break; default: if (!$this->session->getAfterAuthUrl()) { $this->session->setAfterAuthUrl($this->session->getBeforeAuthUrl()); } if ($this->session->isLoggedIn()) { $this->applyRedirect($this->session->getAfterAuthUrl(true)); } break; } }
/** * @return string */ public function getHref() { return $this->isLoggedIn() ? $this->_customerUrl->getLogoutUrl() : $this->_customerUrl->getLoginUrl(); }