Merge pull request #8070 from nupplaphil/bug/8069-logout

Clear cookies before session clear
This commit is contained in:
Hypolite Petovan 2020-01-06 17:22:40 -05:00 committed by GitHub
commit cfae510ef0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View file

@ -28,6 +28,7 @@ use Psr\Log\LoggerInterface;
* @method static Core\Process process() * @method static Core\Process process()
* @method static Core\Session\ISession session() * @method static Core\Session\ISession session()
* @method static Database\Database dba() * @method static Database\Database dba()
* @method static Model\User\Cookie cookie()
* @method static Model\Notify notify() * @method static Model\Notify notify()
* @method static Model\Introduction intro() * @method static Model\Introduction intro()
* @method static Protocol\Activity activity() * @method static Protocol\Activity activity()
@ -61,6 +62,7 @@ abstract class DI
'process' => Core\Process::class, 'process' => Core\Process::class,
'session' => Core\Session\ISession::class, 'session' => Core\Session\ISession::class,
'dba' => Database\Database::class, 'dba' => Database\Database::class,
'cookie' => Model\User\Cookie::class,
'notify' => Model\Notify::class, 'notify' => Model\Notify::class,
'intro' => Model\Introduction::class, 'intro' => Model\Introduction::class,
'activity' => Protocol\Activity::class, 'activity' => Protocol\Activity::class,

View file

@ -6,11 +6,7 @@
namespace Friendica\Module\Security; namespace Friendica\Module\Security;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\App\Authentication;
use Friendica\Core\Cache;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Session;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -30,16 +26,17 @@ class Logout extends BaseModule
$visitor_home = null; $visitor_home = null;
if (remote_user()) { if (remote_user()) {
$visitor_home = Profile::getMyURL(); $visitor_home = Profile::getMyURL();
Cache::delete('zrlInit:' . $visitor_home); DI::cache()->delete('zrlInit:' . $visitor_home);
} }
Hook::callAll("logging_out"); Hook::callAll("logging_out");
Session::clear(); DI::cookie()->clear();
DI::session()->clear();
if ($visitor_home) { if ($visitor_home) {
System::externalRedirect($visitor_home); System::externalRedirect($visitor_home);
} else { } else {
info(L10n::t('Logged out.')); info(DI::l10n()->t('Logged out.'));
DI::baseUrl()->redirect(); DI::baseUrl()->redirect();
} }
} }