From ade94544d47d3a89ee43f96c775807df2e911b1b 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 2b99fad8c13..84b737cf0fb 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -764,17 +764,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); @@ -782,7 +777,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