diff --git a/modules/core/handler_modules.php b/modules/core/handler_modules.php index 3dd1bfef7c..b4d432e551 100644 --- a/modules/core/handler_modules.php +++ b/modules/core/handler_modules.php @@ -1103,6 +1103,8 @@ public function process() { Hm_Msgs::add("Server saved"); $this->out('just_saved_credentials', true); + $this->out('nux_server_id', $this->imap_server_id); + $this->out('nux_service_name', $provider); } } } diff --git a/modules/core/setup.php b/modules/core/setup.php index 646816b357..887cb39987 100644 --- a/modules/core/setup.php +++ b/modules/core/setup.php @@ -217,6 +217,8 @@ 'msg_parts' => array(FILTER_UNSAFE_RAW, false), 'page_links' => array(FILTER_UNSAFE_RAW, false), 'folder_status' => array(FILTER_DEFAULT, FILTER_REQUIRE_ARRAY), + 'nux_server_id' => array(FILTER_DEFAULT, false), + 'nux_service_name' => array(FILTER_DEFAULT, false) ), 'allowed_cookie' => array( 'CYPHTID' => FILTER_DEFAULT, diff --git a/modules/core/site.js b/modules/core/site.js index 1d5b467b73..d208ca937c 100644 --- a/modules/core/site.js +++ b/modules/core/site.js @@ -2188,27 +2188,18 @@ function submitSmtpImapServer() { Hm_Notices.show(res.router_user_msgs); if (res.just_saved_credentials) { - $('#srv_setup_stepper_stepper').find('form').trigger('reset'); - display_config_step(0); - - //Initialize the form - $("#srv_setup_stepper_profile_reply_to").val(''); - $("#srv_setup_stepper_profile_signature").val(''); - $("#srv_setup_stepper_profile_name").val(''); - $("#srv_setup_stepper_email").val(''); - $("#srv_setup_stepper_password").val(''); - $("#srv_setup_stepper_profile_is_default").prop('checked', true); - $("#srv_setup_stepper_is_sender").prop('checked', true); - $("#srv_setup_stepper_is_receiver").prop('checked', true); - $("#srv_setup_stepper_enable_sieve").prop('checked', false); - $("#srv_setup_stepper_only_jmap").prop('checked', false); - $('#step_config-imap_bloc').show(); - $('#step_config-smtp_bloc').show(); - $('#srv_setup_stepper_profile_bloc').show(); - - Hm_Utils.set_unsaved_changes(1); - Hm_Folders.reload_folders(true); - location.reload(); + if (res.nux_server_id) { + Hm_Ajax.request( + [{'name': 'hm_ajax_hook', 'value': 'ajax_imap_accept_special_folders'}, + {'name': 'imap_server_id', value: res.nux_server_id}, + {'name': 'imap_service_name', value: res.nux_service_name}], + function () { + resetQuickSetupForm(); + } + ); + } else { + resetQuickSetupForm(); + } } }, null, null, function (res) { $('#srv_setup_stepper_form_loader').addClass('hide'); @@ -2216,6 +2207,30 @@ function submitSmtpImapServer() { }); } +function resetQuickSetupForm() { + $('#srv_setup_stepper_stepper').find('form').trigger('reset'); + display_config_step(0); + + //Initialize the form + $("#srv_setup_stepper_profile_reply_to").val(''); + $("#srv_setup_stepper_profile_signature").val(''); + $("#srv_setup_stepper_profile_name").val(''); + $("#srv_setup_stepper_email").val(''); + $("#srv_setup_stepper_password").val(''); + $("#srv_setup_stepper_profile_is_default").prop('checked', true); + $("#srv_setup_stepper_is_sender").prop('checked', true); + $("#srv_setup_stepper_is_receiver").prop('checked', true); + $("#srv_setup_stepper_enable_sieve").prop('checked', false); + $("#srv_setup_stepper_only_jmap").prop('checked', false); + $('#step_config-imap_bloc').show(); + $('#step_config-smtp_bloc').show(); + $('#srv_setup_stepper_profile_bloc').show(); + + Hm_Utils.set_unsaved_changes(1); + Hm_Folders.reload_folders(true); + location.reload(); +} + function handleCreateProfileCheckboxChange(checkbox) { if(checkbox.checked) { $('#srv_setup_stepper_profile_bloc').show();