diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-11-20 15:12:52 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-11-20 18:43:09 +0100 |
commit | 535000aac6ea0579e8f7468e4b7f6b822975ed86 (patch) | |
tree | f704d51f913e8c80613ce13aa94cf74c8adb5eea /lib/private | |
parent | 4ddea4bdfbc36e13f7b397a1d881ddff2d364419 (diff) | |
download | nextcloud-server-535000aac6ea0579e8f7468e4b7f6b822975ed86.tar.gz nextcloud-server-535000aac6ea0579e8f7468e4b7f6b822975ed86.zip |
Make the post login event public
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/User/Events/PostLoginEvent.php | 63 | ||||
-rw-r--r-- | lib/private/User/Session.php | 7 |
2 files changed, 3 insertions, 67 deletions
diff --git a/lib/private/User/Events/PostLoginEvent.php b/lib/private/User/Events/PostLoginEvent.php deleted file mode 100644 index d14030b5294..00000000000 --- a/lib/private/User/Events/PostLoginEvent.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -declare(strict_types=1); -/** - * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl> - * - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OC\User\Events; - -use OCP\EventDispatcher\Event; -use OCP\IUser; - -class PostLoginEvent extends Event { - - /** @var IUser */ - private $user; - /** @var string */ - private $password; - /** @var bool */ - private $isTokenLogin; - - - public function __construct(IUser $user, string $password, bool $isTokenLogin) { - parent::__construct(); - - $this->user = $user; - $this->password = $password; - $this->isTokenLogin = $isTokenLogin; - } - - public function getUser(): IUser { - return $this->user; - } - - public function hasPassword(): bool { - return $this->password !== ''; - } - - public function getPassword(): string { - return $this->password; - } - - public function getIsTokenLogin(): bool { - return $this->isTokenLogin; - } -} diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 842d19d8d54..3b0231aea03 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -61,6 +61,7 @@ use OCP\IUserSession; use OCP\Lockdown\ILockdownManager; use OCP\Security\ISecureRandom; use OCP\Session\Exceptions\SessionNotAvailableException; +use OCP\User\Events\PostLoginEvent; use OCP\Util; use Symfony\Component\EventDispatcher\GenericEvent; @@ -398,13 +399,11 @@ class Session implements IUserSession, Emitter { $firstTimeLogin = $user->updateLastLoginTimestamp(); } - $postLoginEvent = new OC\User\Events\PostLoginEvent( + $this->dispatcher->dispatchTyped(new PostLoginEvent( $user, $loginDetails['password'], $isToken - ); - $this->dispatcher->dispatch(OC\User\Events\PostLoginEvent::class, $postLoginEvent); - + )); $this->manager->emit('\OC\User', 'postLogin', [ $user, $loginDetails['password'], |