X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FMagic.php;h=1012dc72baffdbb57fddcb6e69b2ae50e32b7e19;hb=423e60174ef7ae4948fa44ac725c8bc54234966a;hp=42eae695e15dc810106776b0bab186b1edc1f593;hpb=b36d4eb0dd4bdc25a468c95c749bfae1b6324be9;p=friendica.git diff --git a/src/Module/Magic.php b/src/Module/Magic.php index 42eae695e1..1012dc72ba 100644 --- a/src/Module/Magic.php +++ b/src/Module/Magic.php @@ -1,6 +1,6 @@ app = $app; - $this->dba = $dba; - $this->httpClient = $httpClient; + $this->app = $app; + $this->dba = $dba; + $this->httpClient = $httpClient; + $this->userSession = $userSession; } protected function rawContent(array $request = []) @@ -85,14 +88,14 @@ class Magic extends BaseModule $contact = $this->dba->selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]); // Redirect if the contact is already authenticated on this site. - if ($this->app->getContactId() && strpos($contact['nurl'], Strings::normaliseLink($this->baseUrl->get())) !== false) { + if ($this->app->getContactId() && strpos($contact['nurl'], Strings::normaliseLink($this->baseUrl)) !== false) { $this->logger->info('Contact is already authenticated'); System::externalRedirect($dest); } // OpenWebAuth - if (Session::getLocalUser() && $owa) { - $user = User::getById(Session::getLocalUser()); + if ($this->userSession->getLocalUserId() && $owa) { + $user = User::getById($this->userSession->getLocalUserId()); // Extract the basepath // NOTE: we need another solution because this does only work @@ -110,7 +113,7 @@ class Magic extends BaseModule $header = HTTPSignature::createSig( $header, $user['prvkey'], - 'acct:' . $user['nickname'] . '@' . $this->baseUrl->getHostname() . ($this->baseUrl->getUrlPath() ? '/' . $this->baseUrl->getUrlPath() : '') + 'acct:' . $user['nickname'] . '@' . $this->baseUrl->getHost() . ($this->baseUrl->getPath() ? '/' . $this->baseUrl->getPath() : '') ); // Try to get an authentication token from the other instance.