diff options
author | Joas Schilling <coding@schilljs.com> | 2020-12-18 14:46:41 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-01-20 08:50:17 +0100 |
commit | 6c1e294edd7389c8ecffdd2ead2534bf9972c64f (patch) | |
tree | 4e8182e2d3b948990f5310e0f2524fed41f6ba1a /lib | |
parent | 831c807eafa7887eb7072513b4413b8c2a8d102b (diff) | |
download | nextcloud-server-6c1e294edd7389c8ecffdd2ead2534bf9972c64f.tar.gz nextcloud-server-6c1e294edd7389c8ecffdd2ead2534bf9972c64f.zip |
Compare and store the login name via the event
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Server.php | 2 | ||||
-rw-r--r-- | lib/public/User/Events/UserLoggedInEvent.php | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php index 1114e60f475..ba954165799 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -575,7 +575,7 @@ class Server extends ServerContainer implements IServerContainer { /** @var IEventDispatcher $dispatcher */ $dispatcher = $this->get(IEventDispatcher::class); - $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $password, $isTokenLogin)); + $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $loginName, $password, $isTokenLogin)); }); $userSession->listen('\OC\User', 'preRememberedLogin', function ($uid) { /** @var IEventDispatcher $dispatcher */ diff --git a/lib/public/User/Events/UserLoggedInEvent.php b/lib/public/User/Events/UserLoggedInEvent.php index e2cb37a64dc..7d0c0bf41de 100644 --- a/lib/public/User/Events/UserLoggedInEvent.php +++ b/lib/public/User/Events/UserLoggedInEvent.php @@ -43,14 +43,18 @@ class UserLoggedInEvent extends Event { /** @var bool */ private $isTokenLogin; + /** @var string */ + private $loginName; + /** * @since 18.0.0 */ - public function __construct(IUser $user, string $password, bool $isTokenLogin) { + public function __construct(IUser $user, string $loginName, string $password, bool $isTokenLogin) { parent::__construct(); $this->user = $user; $this->password = $password; $this->isTokenLogin = $isTokenLogin; + $this->loginName = $loginName; } /** @@ -61,6 +65,13 @@ class UserLoggedInEvent extends Event { } /** + * @since 21.0.0 + */ + public function getLoginName(): string { + return $this->loginName; + } + + /** * @since 18.0.0 */ public function getPassword(): string { |