diff options
author | Sandro Lutz <sandro.lutz@temparus.ch> | 2017-02-01 18:13:41 +0100 |
---|---|---|
committer | Sandro Lutz <sandro.lutz@temparus.ch> | 2017-02-01 21:53:50 +0100 |
commit | 6feff0cebab20b3738bab239aa1f09b5c91d92ef (patch) | |
tree | 0f5058cfc66d671dffbfd453f8ab2b22937226d1 | |
parent | e30d28f7eb16b86a147a52a2f0452e5b587ddcb9 (diff) | |
download | nextcloud-server-6feff0cebab20b3738bab239aa1f09b5c91d92ef.tar.gz nextcloud-server-6feff0cebab20b3738bab239aa1f09b5c91d92ef.zip |
Add check if UserManager is of type PublicEmitter before calling preLogin hook
Signed-off-by: Sandro Lutz <sandro.lutz@temparus.ch>
-rw-r--r-- | core/Controller/LoginController.php | 4 | ||||
-rw-r--r-- | lib/private/User/Session.php | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index 981e781472f..c53637aaedf 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -215,7 +215,9 @@ class LoginController extends Controller { return $this->generateRedirect($redirect_url); } - $this->userManager->emit('\OC\User', 'preLogin', array($user, $password)); + if ($this->manager instanceof PublicEmitter) { + $this->userManager->emit('\OC\User', 'preLogin', array($user, $password)); + } $originalUser = $user; // TODO: Add all the insane error handling diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 7f7c8182baa..36bd45521cf 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -319,7 +319,9 @@ class Session implements IUserSession, Emitter { OC\Security\Bruteforce\Throttler $throttler) { $currentDelay = $throttler->sleepDelay($request->getRemoteAddress()); - $this->manager->emit('\OC\User', 'preLogin', array($user, $password)); + if ($this->manager instanceof PublicEmitter) { + $this->manager->emit('\OC\User', 'preLogin', array($user, $password)); + } $isTokenPassword = $this->isTokenPassword($password); if (!$isTokenPassword && $this->isTokenAuthEnforced()) { |