aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandro Lutz <sandro.lutz@temparus.ch>2016-12-11 00:20:02 +0100
committerSandro Lutz <sandro.lutz@temparus.ch>2017-02-01 21:50:25 +0100
commit4ebcd5ac0b810314867c04a8dbbbfd484ff34ed1 (patch)
tree1fdb9de81cac01c9063c49d432bc56c595b40550
parent4456fa57e05ecdcc452e5e20b90152b3e5d331fb (diff)
downloadnextcloud-server-4ebcd5ac0b810314867c04a8dbbbfd484ff34ed1.tar.gz
nextcloud-server-4ebcd5ac0b810314867c04a8dbbbfd484ff34ed1.zip
Add preLoginValidation hook
Signed-off-by: Sandro Lutz <sandro.lutz@temparus.ch>
-rw-r--r--core/Controller/LoginController.php3
-rw-r--r--lib/private/Server.php3
2 files changed, 6 insertions, 0 deletions
diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php
index b6add48ef61..0d52a19d57e 100644
--- a/core/Controller/LoginController.php
+++ b/core/Controller/LoginController.php
@@ -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);
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 2c0aac9b43c..c940697dfe8 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -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));
});