Change where preLogin hook gets called

Signed-off-by: Sandro Lutz <sandro.lutz@temparus.ch>
This commit is contained in:
Sandro Lutz 2017-01-31 20:21:58 +01:00
parent 6ab0a3215d
commit e30d28f7eb
2 changed files with 4 additions and 3 deletions

View File

@ -215,6 +215,8 @@ class LoginController extends Controller {
return $this->generateRedirect($redirect_url);
}
$this->userManager->emit('\OC\User', 'preLogin', array($user, $password));
$originalUser = $user;
// TODO: Add all the insane error handling
/* @var $loginResult IUser */

View File

@ -319,6 +319,8 @@ class Session implements IUserSession, Emitter {
OC\Security\Bruteforce\Throttler $throttler) {
$currentDelay = $throttler->sleepDelay($request->getRemoteAddress());
$this->manager->emit('\OC\User', 'preLogin', array($user, $password));
$isTokenPassword = $this->isTokenPassword($password);
if (!$isTokenPassword && $this->isTokenAuthEnforced()) {
throw new PasswordLoginForbiddenException();
@ -463,7 +465,6 @@ class Session implements IUserSession, Emitter {
* @throws LoginException if an app canceld the login process or the user is not enabled
*/
private function loginWithPassword($uid, $password) {
$this->manager->emit('\OC\User', 'preLogin', array($uid, $password));
$user = $this->manager->checkPassword($uid, $password);
if ($user === false) {
// Password check failed
@ -513,8 +514,6 @@ class Session implements IUserSession, Emitter {
// Ignore and use empty string instead
}
$this->manager->emit('\OC\User', 'preLogin', array($uid, $password));
$user = $this->manager->get($uid);
if (is_null($user)) {
// user does not exist