From 9b65ce17cd8e65ec492085619d3ee3a2b25e61f0 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 c4ab3fd48c7..55f3274689c 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -765,17 +765,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); @@ -783,7 +778,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