Add preLoginValidation hook

Signed-off-by: Sandro Lutz <sandro.lutz@temparus.ch>
This commit is contained in:
Sandro Lutz 2016-12-11 00:20:02 +01:00
parent 4456fa57e0
commit 4ebcd5ac0b
2 changed files with 6 additions and 0 deletions

View file

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

View file

@ -295,6 +295,9 @@ class Server extends ServerContainer implements IServerContainer {
/** @var $user \OC\User\User */
\OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
});
$userSession->listen('\OC\User', 'preLoginValidation', function ($uid, $password) {
\OC_Hook::emit('OC_User', 'pre_loginValidation', array('run' => true, 'uid' => $uid, 'password' => $password));
});
$userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
\OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
});