]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Security/Logout.php
Update copyright
[friendica.git] / src / Module / Security / Logout.php
index c698dd00b077bd3d84aebcbf54d22f1254e32c62..1724ae297e497d8579dec7ce66b9dc350fd0fda6 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -26,6 +26,7 @@ use Friendica\Core\Hook;
 use Friendica\Core\System;
 use Friendica\DI;
 use Friendica\Model\Profile;
+use Friendica\Security\TwoFactor;
 
 /**
  * Logout module
@@ -44,6 +45,13 @@ class Logout extends BaseModule
                }
 
                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'));
+               }
+
                DI::cookie()->clear();
                DI::session()->clear();