X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FSecurity%2FLogout.php;h=528dd295e7592eaa6834de89149cbd5b0114d103;hb=99284222c1d7fb4adca9077e3057faf3b36f7180;hp=604c9fc1757356e3f8270304f1a8fd9d008be444;hpb=b67c10812ab962d1ec05cd8c9e256c503d64ca60;p=friendica.git diff --git a/src/Module/Security/Logout.php b/src/Module/Security/Logout.php index 604c9fc175..528dd295e7 100644 --- a/src/Module/Security/Logout.php +++ b/src/Module/Security/Logout.php @@ -1,6 +1,6 @@ cache = $cache; + $this->cookie = $cookie; + $this->session = $session; + } + + /** * Process logout requests */ - public function init() + protected function rawContent(array $request = []) { $visitor_home = null; - if (remote_user()) { + if ($this->session->getRemoteUserId()) { $visitor_home = Profile::getMyURL(); - DI::cache()->delete('zrlInit:' . $visitor_home); + $this->cache->delete('zrlInit:' . $visitor_home); } Hook::callAll("logging_out"); - // Remove this trusted browser as it won't be able to be used ever again after the cookie is cleared - if (DI::cookie()->get('trusted')) { - $trustedBrowserRepository = new TwoFactor\Repository\TrustedBrowser(DI::dba(), DI::logger()); - $trustedBrowserRepository->removeForUser(local_user(), DI::cookie()->get('trusted')); + // If this is a trusted browser, redirect to the 2fa signout page + if ($this->cookie->get('2fa_cookie_hash')) { + $this->baseUrl->redirect('2fa/signout'); } - DI::cookie()->clear(); - DI::session()->clear(); + $this->cookie->clear(); + $this->session->clear(); if ($visitor_home) { System::externalRedirect($visitor_home); } else { - info(DI::l10n()->t('Logged out.')); - DI::baseUrl()->redirect(); + DI::sysmsg()->addInfo($this->t('Logged out.')); + $this->baseUrl->redirect(); } } }