Skip to content

Commit

Permalink
Provide function in rcube to connect to IMAP
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jaudriga committed May 16, 2024
1 parent e695303 commit ec1851f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions program/include/rcmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,25 +762,19 @@ 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);
}
return true;
}


// user already registered -> update user's record
if (is_object($user)) {
// update last login timestamp
Expand Down

0 comments on commit ec1851f

Please sign in to comment.