From 352e651c6d9704c156b6f7821f00536e3e4fe6d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 7 Jun 2021 10:26:13 +0200 Subject: [PATCH] Revert "Add PoC events to user authentication" This was a PoC commit. It is reverted so that it remains in the commit history. This reverts commit 60255db1da3198ea86294c770ae41dedca878573. --- .../files/lib/acp/form/LoginForm.class.php | 9 ---- .../lib/action/FacebookAuthAction.class.php | 3 -- .../lib/action/GithubAuthAction.class.php | 3 -- .../lib/action/GoogleAuthAction.class.php | 3 -- .../lib/action/TwitterAuthAction.class.php | 3 -- .../files/lib/form/LoginForm.class.php | 9 ---- .../MultifactorAuthenticationForm.class.php | 5 --- .../authentication/UserLoggedIn.class.php | 36 --------------- .../UserMultifactorRequested.class.php | 33 -------------- .../UserMultifactorSucceeded.class.php | 45 ------------------- 10 files changed, 149 deletions(-) delete mode 100644 wcfsetup/install/files/lib/system/user/authentication/UserLoggedIn.class.php delete mode 100644 wcfsetup/install/files/lib/system/user/authentication/UserMultifactorRequested.class.php delete mode 100644 wcfsetup/install/files/lib/system/user/authentication/UserMultifactorSucceeded.class.php diff --git a/wcfsetup/install/files/lib/acp/form/LoginForm.class.php b/wcfsetup/install/files/lib/acp/form/LoginForm.class.php index ed038fb849..7d36887dec 100755 --- a/wcfsetup/install/files/lib/acp/form/LoginForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LoginForm.class.php @@ -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(); } diff --git a/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php b/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php index e038193efc..901a855584 100644 --- a/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php +++ b/wcfsetup/install/files/lib/action/FacebookAuthAction.class.php @@ -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()); diff --git a/wcfsetup/install/files/lib/action/GithubAuthAction.class.php b/wcfsetup/install/files/lib/action/GithubAuthAction.class.php index 98e5de3657..a8a034e3b1 100644 --- a/wcfsetup/install/files/lib/action/GithubAuthAction.class.php +++ b/wcfsetup/install/files/lib/action/GithubAuthAction.class.php @@ -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()); diff --git a/wcfsetup/install/files/lib/action/GoogleAuthAction.class.php b/wcfsetup/install/files/lib/action/GoogleAuthAction.class.php index 5cab421cfb..078e9b6425 100644 --- a/wcfsetup/install/files/lib/action/GoogleAuthAction.class.php +++ b/wcfsetup/install/files/lib/action/GoogleAuthAction.class.php @@ -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()); diff --git a/wcfsetup/install/files/lib/action/TwitterAuthAction.class.php b/wcfsetup/install/files/lib/action/TwitterAuthAction.class.php index efb7ff0976..447450027a 100644 --- a/wcfsetup/install/files/lib/action/TwitterAuthAction.class.php +++ b/wcfsetup/install/files/lib/action/TwitterAuthAction.class.php @@ -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()); } diff --git a/wcfsetup/install/files/lib/form/LoginForm.class.php b/wcfsetup/install/files/lib/form/LoginForm.class.php index 9f7c028640..95fadd5b49 100644 --- a/wcfsetup/install/files/lib/form/LoginForm.class.php +++ b/wcfsetup/install/files/lib/form/LoginForm.class.php @@ -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 diff --git a/wcfsetup/install/files/lib/form/MultifactorAuthenticationForm.class.php b/wcfsetup/install/files/lib/form/MultifactorAuthenticationForm.class.php index aa9bc2c893..ffeb52fef6 100644 --- a/wcfsetup/install/files/lib/form/MultifactorAuthenticationForm.class.php +++ b/wcfsetup/install/files/lib/form/MultifactorAuthenticationForm.class.php @@ -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 index 1f76a76751..0000000000 --- a/wcfsetup/install/files/lib/system/user/authentication/UserLoggedIn.class.php +++ /dev/null @@ -1,36 +0,0 @@ - - * @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 index a4051b3221..0000000000 --- a/wcfsetup/install/files/lib/system/user/authentication/UserMultifactorRequested.class.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @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 index 82fe5d479a..0000000000 --- a/wcfsetup/install/files/lib/system/user/authentication/UserMultifactorSucceeded.class.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @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; - } -} -- 2.20.1