Skip to content

Commit 9b65ce1

Browse files
committed
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
1 parent 8b291d7 commit 9b65ce1

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

program/include/rcmail.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -765,25 +765,19 @@ public function login($username, $password, $host = null, $cookiecheck = false,
765765
$storage = $this->get_storage();
766766

767767
// try to log in
768-
if (!$storage->connect($host, $username, $password, $port, $ssl)) {
769-
if ($user) {
770-
$user->failed_login();
771-
}
772-
773-
// Wait a second to slow down brute-force attacks (#1490549)
774-
sleep(1);
768+
if (!$this->imap_connect($storage, $host, $username, $password, $port, $ssl, $user)) {
775769
return false;
776770
}
777771

778-
// Only set user if just wanting to connect
772+
// Only set user if just wanting to connect.
773+
// Note that for other scenarios user will also be set after successful login.
779774
if ($just_connect) {
780775
if (is_object($user)) {
781776
$this->set_user($user);
782777
}
783778
return true;
784779
}
785780

786-
787781
// user already registered -> update user's record
788782
if (is_object($user)) {
789783
// update last login timestamp

0 commit comments

Comments
 (0)