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;
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;
// 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();
}
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;
// Perform the login.
WCF::getSession()->changeUser($user);
+ EventHandler::getInstance()->fire(new UserLoggedIn($user));
WCF::getSession()->update();
HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
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;
// Perform the login.
WCF::getSession()->changeUser($user);
+ EventHandler::getInstance()->fire(new UserLoggedIn($user));
WCF::getSession()->update();
HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
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;
// Perform the login.
WCF::getSession()->changeUser($user);
+ EventHandler::getInstance()->fire(new UserLoggedIn($user));
WCF::getSession()->update();
HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
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;
} // perform login
else {
WCF::getSession()->changeUser($user);
+ EventHandler::getInstance()->fire(new UserLoggedIn($user));
WCF::getSession()->update();
HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
}
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;
/**
// 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
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;
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();
--- /dev/null
+<?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;
+ }
+}
--- /dev/null
+<?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;
+ }
+}
--- /dev/null
+<?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;
+ }
+}