Add check if UserManager is of type PublicEmitter before calling preLogin hook

Signed-off-by: Sandro Lutz <sandro.lutz@temparus.ch>
This commit is contained in:
Sandro Lutz 2017-02-01 18:13:41 +01:00
parent e30d28f7eb
commit 6feff0ceba
2 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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()) {