Skip to content

Commit

Permalink
[FIX]Error Ocurred when attempting Microsoft's email oauth2 setup
Browse files Browse the repository at this point in the history
  • Loading branch information
christer77 committed Nov 15, 2024
1 parent 495852c commit 0c12be9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion modules/imap/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ function clear_existing_reply_details($session) {
*/
if (!hm_exists('imap_authed')) {
function imap_authed($imap) {
return is_object($imap) && ($imap->get_state() == 'authenticated' || $imap->get_state() == 'selected');
return is_object($imap) && ($imap->get_state() == 'authenticated' || $imap->get_state() == 'selected' || $imap->get_state() == 'connected');
}}

/**
Expand Down
10 changes: 5 additions & 5 deletions modules/imap_folders/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function process() {
$cache = Hm_IMAP_List::get_cache($this->cache, $form['imap_server_id']);
$imap = Hm_IMAP_List::connect($form['imap_server_id'], $cache);

if (!is_object($imap) || $imap->get_state() != 'authenticated') {
if (!is_object($imap) || ($imap->get_state() != 'authenticated' && $imap->get_state() != 'connected')) {
Hm_Msgs::add('ERRUnable to connect to the selected IMAP server');
return;
}
Expand Down Expand Up @@ -135,7 +135,7 @@ public function process() {
$cache = Hm_IMAP_List::get_cache($this->cache, $form['imap_server_id']);
$imap = Hm_IMAP_List::connect($form['imap_server_id'], $cache);

if (!is_object($imap) || $imap->get_state() != 'authenticated') {
if (!is_object($imap) || ($imap->get_state() != 'authenticated' && $imap->get_state() != 'connected')) {
Hm_Msgs::add('ERRUnable to connect to the selected IMAP server');
return;
}
Expand Down Expand Up @@ -184,7 +184,7 @@ public function process() {
}
$cache = Hm_IMAP_List::get_cache($this->cache, $form['imap_server_id']);
$imap = Hm_IMAP_List::connect($form['imap_server_id'], $cache);
if (is_object($imap) && $imap->get_state() == 'authenticated') {
if (is_object($imap) && ($imap->get_state() == 'authenticated' || $imap->get_state() == 'connected')) {
$new_folder = prep_folder_name($imap, $form['folder'], false, $parent_str);
if ($new_folder && $imap->create_mailbox($new_folder)) {
Hm_Msgs::add('Folder created');
Expand Down Expand Up @@ -212,7 +212,7 @@ public function process() {
if (array_key_exists('parent', $this->request->post)) {
$parent_str = $this->request->post['parent'];
}
if (is_object($imap) && $imap->get_state() == 'authenticated') {
if (is_object($imap) && ($imap->get_state() == 'authenticated' || $imap->get_state() == 'connected')) {
$old_folder = prep_folder_name($imap, $form['folder'], true);
$new_folder = prep_folder_name($imap, $form['new_folder'], false, $parent_str);
if ($new_folder && $old_folder && $imap->rename_mailbox($old_folder, $new_folder)) {
Expand Down Expand Up @@ -273,7 +273,7 @@ public function process() {
if ($success) {
$cache = Hm_IMAP_List::get_cache($this->cache, $form['imap_server_id']);
$imap = Hm_IMAP_List::connect($form['imap_server_id'], $cache);
if (is_object($imap) && $imap->get_state() == 'authenticated') {
if (is_object($imap) && ($imap->get_state() == 'authenticated' || $imap->get_state() == 'connected')) {
$del_folder = prep_folder_name($imap, $form['folder'], true);
if ($this->module_is_supported('sievefilters') && $this->user_config->get('enable_sieve_filter_setting', DEFAULT_ENABLE_SIEVE_FILTER)) {
if (is_mailbox_linked_with_filters($del_folder, $form['imap_server_id'], $this)) {
Expand Down
2 changes: 1 addition & 1 deletion modules/nux/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function process() {
return;
}
$imap = Hm_IMAP_List::connect($new_id, false);
if ($imap && $imap->get_state() == 'authenticated') {
if ($imap && ($imap->get_state() == 'authenticated' || $imap->get_state() == 'connected')) {
if (isset($details['smtp'])) {
Hm_SMTP_List::add(array(
'name' => $details['name'],
Expand Down
4 changes: 2 additions & 2 deletions modules/nux/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ var display_final_nux_step = function(res) {
{'name': 'imap_server_id', value: res.nux_server_id},
{'name': 'imap_service_name', value: res.nux_service_name}],
function () {
Hm_Utils.redirect();
Hm_Utils.redirect('?page=servers');
}
);
} else {
Hm_Utils.redirect();
Hm_Utils.redirect('?page=servers');
}
}
};
Expand Down

0 comments on commit 0c12be9

Please sign in to comment.