From 060467df9d95be3768dab51ff5dd4e6214ec86a0 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 02 Sep 2013 05:45:28 -0400
Subject: [PATCH] Log also failed logins to userlogins log

---
 index.php |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/index.php b/index.php
index 2d220de..3be71f2 100644
--- a/index.php
+++ b/index.php
@@ -138,7 +138,7 @@
   }
   else {
     if (!$auth['valid']) {
-      $error_code  = RCMAIL::ERROR_INVALID_REQUEST;
+      $error_code = RCMAIL::ERROR_INVALID_REQUEST;
     }
     else {
       $error_code = $auth['error'] ? $auth['error'] : $RCMAIL->login_error();
@@ -153,6 +153,9 @@
 
     $error_message = $error_labels[$error_code] ? $error_labels[$error_code] : 'loginfailed';
 
+    // log failed login
+    $RCMAIL->log_login($auth['user'], true, $error_code);
+
     $OUTPUT->show_message($error_message, 'warning');
     $RCMAIL->plugins->exec_hook('login_failed', array(
       'code' => $error_code, 'host' => $auth['host'], 'user' => $auth['user']));

--
Gitblit v1.9.1