From ec1851f27c4347cf4bd3abcd3d6ce5853779a8da Mon Sep 17 00:00:00 2001 From: Joris Baum Date: Tue, 16 Apr 2024 11:49:12 +0200 Subject: [PATCH] Provide function in rcube to connect to IMAP This is useful for plugins like FreeBusy [1] that previously connected to IMAP via plain rcube_imap::connect(). [1] https://git.kolab.org/source/freebusy/browse/master/lib/Kolab/FreeBusy/SourceIMAP.php --- program/include/rcmail.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/program/include/rcmail.php b/program/include/rcmail.php index bbbf31d75c..a0f04436a2 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -762,17 +762,12 @@ public function login($username, $password, $host = null, $cookiecheck = false, $storage = $this->get_storage(); // try to log in - if (!$storage->connect($host, $username, $password, $port, $ssl)) { - if ($user) { - $user->failed_login(); - } - - // Wait a second to slow down brute-force attacks (#1490549) - sleep(1); + if (!$this->imap_connect($storage, $host, $username, $password, $port, $ssl, $user)) { return false; } - // Only set user if just wanting to connect + // Only set user if just wanting to connect. + // Note that for other scenarios user will also be set after successful login. if ($just_connect) { if (is_object($user)) { $this->set_user($user); @@ -780,7 +775,6 @@ public function login($username, $password, $host = null, $cookiecheck = false, return true; } - // user already registered -> update user's record if (is_object($user)) { // update last login timestamp