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 13, 2024
1 parent 0f405f4 commit ade9454
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 @@ -764,25 +764,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 ade9454

Please sign in to comment.