Skip to content

Commit 38e9466

Browse files
refactor(backend): expose imap instance
1 parent ac7f5d9 commit 38e9466

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/auth.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ private function check_connection($imap) {
183183
return true;
184184
}
185185
elseif ($imap->get_state() != 'connected') {
186-
error_log(sprintf('Unable to connect to the IMAP auth server %s', $this->imap_settings['server']));
187186
Hm_Debug::add($imap->show_debug(true));
188187
Hm_Debug::add(sprintf('Unable to connect to the IMAP auth server %s', $this->imap_settings['server']));
189188
return false;
@@ -203,11 +202,10 @@ private function check_connection($imap) {
203202
* @return bool true if authentication worked
204203
*/
205204
public function check_credentials($user, $pass) {
206-
$imap = new Hm_IMAP();
207-
$this->imap_instance = $imap;
205+
$this->imap_instance = new Hm_IMAP();;
208206
list($server, $port, $tls, $sieve_config, $sieve_tls_mode) = get_auth_config($this->site_config, 'imap');
209207
if (!$user || !$pass || !$server || !$port) {
210-
Hm_Debug::add($imap->show_debug(true));
208+
Hm_Debug::add($this->imap_instance->show_debug(true));
211209
Hm_Debug::add('Invalid IMAP auth configuration settings');
212210
return false;
213211
}
@@ -217,7 +215,7 @@ public function check_credentials($user, $pass) {
217215
'sieve_config_host' => $sieve_config,
218216
'sieve_tls' => $sieve_tls_mode
219217
];
220-
return $this->check_connection($imap);
218+
return $this->check_connection($this->imap_instance);
221219
}
222220

223221
/**

0 commit comments

Comments
 (0)