From 0347c224ca4402160c92ca2f23bf72459b851e35 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Mon, 23 May 2016 16:19:30 +0200 Subject: [PATCH] Fixed logging of user id in authentication failures --- wcfsetup/install/files/lib/acp/form/LoginForm.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/acp/form/LoginForm.class.php b/wcfsetup/install/files/lib/acp/form/LoginForm.class.php index 1dee48335c..da8418b901 100755 --- a/wcfsetup/install/files/lib/acp/form/LoginForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LoginForm.class.php @@ -150,10 +150,13 @@ class LoginForm extends AbstractCaptchaForm { // save authentication failure if (ENABLE_USER_AUTHENTICATION_FAILURE) { if ($this->errorField == 'username' || $this->errorField == 'password') { + $user = User::getUserByUsername($this->username); + if (!$user->userID) $user = User::getUserByEmail($this->username); + $action = new UserAuthenticationFailureAction([], 'create', [ 'data' => [ 'environment' => (RequestHandler::getInstance()->isACPRequest() ? 'admin' : 'user'), - 'userID' => ($this->user !== null ? $this->user->userID : null), + 'userID' => ($user->userID ?: null), 'username' => $this->username, 'time' => TIME_NOW, 'ipAddress' => UserUtil::getIpAddress(), -- 2.20.1