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\Session\ISession session()
* @method static Database\Database dba()
* @method static Model\User\Cookie cookie()
* @method static Model\Notify notify()
* @method static Model\Introduction intro()
* @method static Protocol\Activity activity()
@ -61,6 +62,7 @@ abstract class DI
'process' => Core\Process::class,
'session' => Core\Session\ISession::class,
'dba' => Database\Database::class,
'cookie' => Model\User\Cookie::class,
'notify' => Model\Notify::class,
'intro' => Model\Introduction::class,
'activity' => Protocol\Activity::class,

View file

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