Permalink
Browse files

Add two hooks user.before_login and user.after_login

  • Loading branch information...
1 parent 5b26fff commit 382bf6b982e4d8a4a5d596c95a319959bd892682 @cdujeu cdujeu committed Jun 29, 2016
Showing with 6 additions and 2 deletions.
  1. +6 −2 core/src/core/src/pydio/Core/Services/AuthService.php
@@ -114,9 +114,12 @@ public static function logUser($user_id, $pwd, $bypass_pwd = false, $cookieLogin
BruteForceHelper::setBruteForceLoginArray($loginAttempt, true);
$user = UsersService::getUserById($user_id, false);
-
+
+ $tempContext = Context::contextWithObjects($user, null);
+ Controller::applyHook("user.before_login", [$tempContext, &$user]);
+
// Setting session credentials if asked in config
- if (ConfService::getContextConf(Context::contextWithObjects($user, null), "SESSION_SET_CREDENTIALS", "auth")) {
+ if (ConfService::getContextConf($tempContext, "SESSION_SET_CREDENTIALS", "auth")) {
list($authId, $authPwd) = $authDriver->filterCredentials($user_id, $pwd);
MemorySafe::storeCredentials($authId, $authPwd);
}
@@ -140,6 +143,7 @@ public static function logUser($user_id, $pwd, $bypass_pwd = false, $cookieLogin
}
self::updateUser($user);
+ Controller::applyHook("user.after_login", [$tempContext, $user]);
Logger::info(__CLASS__, "Log In", array("context"=>self::$useSession?"WebUI":"API"));
return $user;

0 comments on commit 382bf6b

Please sign in to comment.