Skip to content

Commit 60d2454

Browse files
committed
fix(backend): handle undefined array keys username and password
1 parent e5a8d31 commit 60d2454

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/imap/hm-ews.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ class Hm_EWS {
4242

4343
public function connect(array $config) {
4444
try {
45-
$this->ews = ExchangeWebServices::fromUsernameAndPassword($config['server'], $config['username'], $config['password'], ['version' => ExchangeWebServices::VERSION_2016, 'trace' => 1]);
45+
$password = $config['password'] ?? '';
46+
$username = isset($config['username']) ? $config['username'] : '';
47+
if (!$username && isset($config['user'])) {
48+
$username = $config['user'];
49+
}
50+
$this->ews = ExchangeWebServices::fromUsernameAndPassword($config['server'], $username, $password, ['version' => ExchangeWebServices::VERSION_2016, 'trace' => 1]);
4651
$this->api = new MailAPI($this->ews);
4752
$this->api->getFolderByDistinguishedId(Enumeration\DistinguishedFolderIdNameType::INBOX);
4853
$this->authed = true;

0 commit comments

Comments
 (0)