Revert "Add PoC events to user authentication"
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 7 Jun 2021 08:26:13 +0000 (10:26 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 7 Jun 2021 11:51:17 +0000 (13:51 +0200)
This was a PoC commit. It is reverted so that it remains in the commit history.

This reverts commit 60255db1da3198ea86294c770ae41dedca878573.

wcfsetup/install/files/lib/acp/form/LoginForm.class.php
wcfsetup/install/files/lib/action/FacebookAuthAction.class.php
wcfsetup/install/files/lib/action/GithubAuthAction.class.php
wcfsetup/install/files/lib/action/GoogleAuthAction.class.php
wcfsetup/install/files/lib/action/TwitterAuthAction.class.php
wcfsetup/install/files/lib/form/LoginForm.class.php
wcfsetup/install/files/lib/form/MultifactorAuthenticationForm.class.php
wcfsetup/install/files/lib/system/user/authentication/UserLoggedIn.class.php [deleted file]
wcfsetup/install/files/lib/system/user/authentication/UserMultifactorRequested.class.php [deleted file]
wcfsetup/install/files/lib/system/user/authentication/UserMultifactorSucceeded.class.php [deleted file]

index ed038fb849d2804e3b9cf8368c31e6ac8497e6d4..7d36887dec0a647defbb639091303d7e5a89e352 100755 (executable)
@@ -8,7 +8,6 @@ use wcf\data\user\User;
 use wcf\data\user\UserProfile;
 use wcf\form\AbstractCaptchaForm;
 use wcf\system\application\ApplicationHandler;
-use wcf\system\event\EventHandler;
 use wcf\system\exception\NamedUserException;
 use wcf\system\exception\UserInputException;
 use wcf\system\request\LinkHandler;
@@ -16,8 +15,6 @@ use wcf\system\request\RequestHandler;
 use wcf\system\request\RouteHandler;
 use wcf\system\user\authentication\EmailUserAuthentication;
 use wcf\system\user\authentication\UserAuthenticationFactory;
-use wcf\system\user\authentication\UserLoggedIn;
-use wcf\system\user\authentication\UserMultifactorRequested;
 use wcf\system\WCF;
 use wcf\util\HeaderUtil;
 use wcf\util\StringUtil;
@@ -227,12 +224,6 @@ class LoginForm extends AbstractCaptchaForm
 
         // change user
         $needsMultifactor = WCF::getSession()->changeUserAfterMultifactorAuthentication($this->user);
-        if ($needsMultifactor) {
-            EventHandler::getInstance()->fire(new UserMultifactorRequested($this->user));
-        } else {
-            EventHandler::getInstance()->fire(new UserLoggedIn($this->user));
-        }
-
         if (!$needsMultifactor) {
             WCF::getSession()->registerReauthentication();
         }
index e038193efc169b1aa8be04c0f378b80ea511f143..901a855584592b3ba77a398f9413c74f9ad76bea 100644 (file)
@@ -5,11 +5,9 @@ namespace wcf\action;
 use GuzzleHttp\Psr7\Request;
 use wcf\data\user\User;
 use wcf\form\RegisterForm;
-use wcf\system\event\EventHandler;
 use wcf\system\exception\NamedUserException;
 use wcf\system\request\LinkHandler;
 use wcf\system\user\authentication\oauth\User as OauthUser;
-use wcf\system\user\authentication\UserLoggedIn;
 use wcf\system\WCF;
 use wcf\util\HeaderUtil;
 use wcf\util\JSON;
@@ -134,7 +132,6 @@ final class FacebookAuthAction extends AbstractOauth2Action
                 // Perform the login.
 
                 WCF::getSession()->changeUser($user);
-                EventHandler::getInstance()->fire(new UserLoggedIn($user));
                 WCF::getSession()->update();
                 HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
 
index 98e5de3657085fb175c212889008cc0a902863a6..a8a034e3b1b4224768bf0b6bd422b7c103d3c40d 100644 (file)
@@ -6,11 +6,9 @@ use GuzzleHttp\Psr7\Request;
 use Psr\Http\Client\ClientExceptionInterface;
 use wcf\data\user\User;
 use wcf\form\RegisterForm;
-use wcf\system\event\EventHandler;
 use wcf\system\exception\NamedUserException;
 use wcf\system\request\LinkHandler;
 use wcf\system\user\authentication\oauth\User as OauthUser;
-use wcf\system\user\authentication\UserLoggedIn;
 use wcf\system\WCF;
 use wcf\util\HeaderUtil;
 use wcf\util\JSON;
@@ -126,7 +124,6 @@ final class GithubAuthAction extends AbstractOauth2Action
                 // Perform the login.
 
                 WCF::getSession()->changeUser($user);
-                EventHandler::getInstance()->fire(new UserLoggedIn($user));
                 WCF::getSession()->update();
                 HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
 
index 5cab421cfbe1df84f5d518337cc5c5aa2b38bfc1..078e9b64259bee7b1af328f28e34af8fcfdde2d0 100644 (file)
@@ -5,11 +5,9 @@ namespace wcf\action;
 use GuzzleHttp\Psr7\Request;
 use wcf\data\user\User;
 use wcf\form\RegisterForm;
-use wcf\system\event\EventHandler;
 use wcf\system\exception\NamedUserException;
 use wcf\system\request\LinkHandler;
 use wcf\system\user\authentication\oauth\User as OauthUser;
-use wcf\system\user\authentication\UserLoggedIn;
 use wcf\system\WCF;
 use wcf\util\HeaderUtil;
 use wcf\util\JSON;
@@ -148,7 +146,6 @@ final class GoogleAuthAction extends AbstractOauth2Action
                 // Perform the login.
 
                 WCF::getSession()->changeUser($user);
-                EventHandler::getInstance()->fire(new UserLoggedIn($user));
                 WCF::getSession()->update();
                 HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
 
index efb7ff09762af9d6ff285cee5eb0eaf262c76d34..447450027ab28fdfa9c194bcfc98e907195fd761 100644 (file)
@@ -4,13 +4,11 @@ namespace wcf\action;
 
 use ParagonIE\ConstantTime\Hex;
 use wcf\data\user\User;
-use wcf\system\event\EventHandler;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\NamedUserException;
 use wcf\system\exception\PermissionDeniedException;
 use wcf\system\exception\SystemException;
 use wcf\system\request\LinkHandler;
-use wcf\system\user\authentication\UserLoggedIn;
 use wcf\system\WCF;
 use wcf\util\HeaderUtil;
 use wcf\util\HTTPRequest;
@@ -106,7 +104,6 @@ class TwitterAuthAction extends AbstractAction
                 } // perform login
                 else {
                     WCF::getSession()->changeUser($user);
-                    EventHandler::getInstance()->fire(new UserLoggedIn($user));
                     WCF::getSession()->update();
                     HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
                 }
index 9f7c0286401f030346a78703ece34a316be97190..95fadd5b494cc89271b73b5053dc494d844b054b 100644 (file)
@@ -2,10 +2,7 @@
 
 namespace wcf\form;
 
-use wcf\system\event\EventHandler;
 use wcf\system\request\LinkHandler;
-use wcf\system\user\authentication\UserLoggedIn;
-use wcf\system\user\authentication\UserMultifactorRequested;
 use wcf\system\WCF;
 
 /**
@@ -34,12 +31,6 @@ class LoginForm extends \wcf\acp\form\LoginForm
         // change user
         $needsMultifactor = WCF::getSession()->changeUserAfterMultifactorAuthentication($this->user);
 
-        if ($needsMultifactor) {
-            EventHandler::getInstance()->fire(new UserMultifactorRequested($this->user));
-        } else {
-            EventHandler::getInstance()->fire(new UserLoggedIn($this->user));
-        }
-
         $this->saved();
 
         // redirect to url
index aa9bc2c8931c61ac521e1a4fc6a07f986e9cc399..ffeb52fef6cfe93d599abc81264964b44c1fbd3e 100644 (file)
@@ -6,13 +6,10 @@ use wcf\data\object\type\ObjectType;
 use wcf\data\user\User;
 use wcf\system\application\ApplicationHandler;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
-use wcf\system\event\EventHandler;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\NamedUserException;
 use wcf\system\form\builder\TemplateFormNode;
 use wcf\system\request\LinkHandler;
-use wcf\system\user\authentication\UserLoggedIn;
-use wcf\system\user\authentication\UserMultifactorSucceeded;
 use wcf\system\user\multifactor\IMultifactorMethod;
 use wcf\system\user\multifactor\Setup;
 use wcf\system\WCF;
@@ -147,8 +144,6 @@ class MultifactorAuthenticationForm extends AbstractFormBuilderForm
         WCF::getDB()->commitTransaction();
 
         WCF::getSession()->applyPendingUserChange($this->user);
-        EventHandler::getInstance()->fire(new UserLoggedIn($this->user));
-        EventHandler::getInstance()->fire(new UserMultifactorSucceeded($this->user, $setup));
         WCF::getSession()->registerReauthentication();
 
         $this->saved();
diff --git a/wcfsetup/install/files/lib/system/user/authentication/UserLoggedIn.class.php b/wcfsetup/install/files/lib/system/user/authentication/UserLoggedIn.class.php
deleted file mode 100644 (file)
index 1f76a76..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-namespace wcf\system\user\authentication;
-
-use wcf\data\user\User;
-use wcf\system\event\IEvent;
-
-/**
- * Indicates that the user logged in.
- *
- * Differs from SessionHandler::changeUser() in that it is fired for active logins only and not for user changes
- * that are required for technical reasons.
- *
- * @author  Tim Duesterhus
- * @copyright   2001-2021 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package WoltLabSuite\Core\System\User\Authentication
- * @since   5.5
- */
-final class UserLoggedIn implements IEvent
-{
-    /**
-     * @var User
-     */
-    private $user;
-
-    public function __construct(User $user)
-    {
-        $this->user = $user;
-    }
-
-    public function getUser(): User
-    {
-        return $this->user;
-    }
-}
diff --git a/wcfsetup/install/files/lib/system/user/authentication/UserMultifactorRequested.class.php b/wcfsetup/install/files/lib/system/user/authentication/UserMultifactorRequested.class.php
deleted file mode 100644 (file)
index a4051b3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-namespace wcf\system\user\authentication;
-
-use wcf\data\user\User;
-use wcf\system\event\IEvent;
-
-/**
- * Indicates that the user entered their password successfully and needs to perform MF authentication.
- *
- * @author  Tim Duesterhus
- * @copyright   2001-2021 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package WoltLabSuite\Core\System\User\Authentication
- * @since   5.5
- */
-final class UserMultifactorRequested implements IEvent
-{
-    /**
-     * @var User
-     */
-    private $user;
-
-    public function __construct(User $user)
-    {
-        $this->user = $user;
-    }
-
-    public function getUser(): User
-    {
-        return $this->user;
-    }
-}
diff --git a/wcfsetup/install/files/lib/system/user/authentication/UserMultifactorSucceeded.class.php b/wcfsetup/install/files/lib/system/user/authentication/UserMultifactorSucceeded.class.php
deleted file mode 100644 (file)
index 82fe5d4..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-namespace wcf\system\user\authentication;
-
-use wcf\data\user\User;
-use wcf\system\event\IEvent;
-use wcf\system\user\multifactor\Setup;
-
-/**
- * Indicates that the user successfully performed MF authentication with the given setup ("method").
- *
- * @author  Tim Duesterhus
- * @copyright   2001-2021 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package WoltLabSuite\Core\System\User\Authentication
- * @since   5.5
- */
-final class UserMultifactorSucceeded implements IEvent
-{
-    /**
-     * @var User
-     */
-    private $user;
-
-    /**
-     * @var Setup
-     */
-    private $setup;
-
-    public function __construct(User $user, Setup $setup)
-    {
-        $this->user = $user;
-        $this->setup = $setup;
-    }
-
-    public function getUser(): User
-    {
-        return $this->user;
-    }
-
-    public function getSetup(): Setup
-    {
-        return $this->setup;
-    }
-}