From 26735ec5cd185ba2852f114fc6c0dc3d261f4b01 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Mon, 5 Feb 2024 17:08:02 +0100 Subject: [PATCH 1/8] Fix condition to check for 'addusers' key in get-configuration script --- imageroot/actions/get-configuration/20read | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imageroot/actions/get-configuration/20read b/imageroot/actions/get-configuration/20read index 49c6366..1529b5a 100755 --- a/imageroot/actions/get-configuration/20read +++ b/imageroot/actions/get-configuration/20read @@ -36,7 +36,7 @@ for key in agent.list_service_providers(rdb,'imap','tcp'): mail = key['module_id'] get_retval = agent.tasks.run(f"module/{mail}",'list-domains') for kd in get_retval['output']: - if kd['addusers']: + if 'addusers' in kd: obj = { "name": key['module_id'], "label": f"{kd['domain']} ({key['mail_hostname']})", From 84d03dee94844b8b81f13a4574e69859fa01309b Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Tue, 6 Feb 2024 10:20:07 +0100 Subject: [PATCH 2/8] Fix condition to check if 'addusers' is True in get-configuration --- imageroot/actions/get-configuration/20read | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imageroot/actions/get-configuration/20read b/imageroot/actions/get-configuration/20read index 1529b5a..a2928e2 100755 --- a/imageroot/actions/get-configuration/20read +++ b/imageroot/actions/get-configuration/20read @@ -36,7 +36,7 @@ for key in agent.list_service_providers(rdb,'imap','tcp'): mail = key['module_id'] get_retval = agent.tasks.run(f"module/{mail}",'list-domains') for kd in get_retval['output']: - if 'addusers' in kd: + if 'addusers' in kd and kd.get('addusers') == True: obj = { "name": key['module_id'], "label": f"{kd['domain']} ({key['mail_hostname']})", From 520f54ef98ecde787efa4d85334d6231ff856435 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Tue, 6 Feb 2024 10:20:12 +0100 Subject: [PATCH 3/8] Add error message for no available mail domain --- ui/public/i18n/en/translation.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/public/i18n/en/translation.json b/ui/public/i18n/en/translation.json index 1922612..354d323 100644 --- a/ui/public/i18n/en/translation.json +++ b/ui/public/i18n/en/translation.json @@ -40,7 +40,8 @@ "choose_mail_server": "Select a domain", "choose_the_mail_server_to_use": "Choose the domain suffix used for both identifying and initializing the user account and their mail address preferences", "mail_server_is_not_valid": "This mail server cannot be used by Roundcube webmail", - "upload_max_filesize_number_lte": "Must be less than 120 MB" + "upload_max_filesize_number_lte": "Must be less than 120 MB", + "no_available_mail_domain_check_users": "No available mail domain, please check if users are added from user domain" }, "about": { "title": "About" From 0b171de84eb27242f4ddbc433465ef22693ba286 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Tue, 6 Feb 2024 10:20:17 +0100 Subject: [PATCH 4/8] Add default value for empty mail server URL --- ui/src/views/Settings.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ui/src/views/Settings.vue b/ui/src/views/Settings.vue index 4995551..29be9b0 100644 --- a/ui/src/views/Settings.vue +++ b/ui/src/views/Settings.vue @@ -286,6 +286,16 @@ export default { } else { this.mail_server = ""; } + // if mail_server_URL is empty, set default value + if (this.mail_server_URL.length === 0) { + this.mail_server_URL.push({ + label: this.$t("settings.no_available_mail_domain_check_users"), + value: "", + name: "" + }); + // we want to avoid to save the form, there is no users set in the mail domain + this.mail_server = ""; + } }); this.mail_server_URL = config.mail_server_URL; From c08b8e4d38cfcba5ddeaa06b4cfc96edb802a697 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Tue, 6 Feb 2024 10:49:41 +0100 Subject: [PATCH 5/8] Refactor condition to simplify code --- imageroot/actions/get-configuration/20read | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imageroot/actions/get-configuration/20read b/imageroot/actions/get-configuration/20read index a2928e2..cb201e7 100755 --- a/imageroot/actions/get-configuration/20read +++ b/imageroot/actions/get-configuration/20read @@ -36,7 +36,7 @@ for key in agent.list_service_providers(rdb,'imap','tcp'): mail = key['module_id'] get_retval = agent.tasks.run(f"module/{mail}",'list-domains') for kd in get_retval['output']: - if 'addusers' in kd and kd.get('addusers') == True: + if kd.get('addusers') == True: obj = { "name": key['module_id'], "label": f"{kd['domain']} ({key['mail_hostname']})", From b6b4b7b4e1ab9c5e347f09024365b1b2a71aa0e3 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Tue, 6 Feb 2024 11:14:33 +0100 Subject: [PATCH 6/8] Add warning notification for misconfigured mail module --- ui/src/views/Settings.vue | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ui/src/views/Settings.vue b/ui/src/views/Settings.vue index 29be9b0..1ed3eeb 100644 --- a/ui/src/views/Settings.vue +++ b/ui/src/views/Settings.vue @@ -61,6 +61,16 @@ $t("settings.enabled") }} + + + + + Date: Tue, 6 Feb 2024 11:14:38 +0100 Subject: [PATCH 7/8] Add error message for misconfigured mail module --- ui/public/i18n/en/translation.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/public/i18n/en/translation.json b/ui/public/i18n/en/translation.json index 354d323..a01bb4a 100644 --- a/ui/public/i18n/en/translation.json +++ b/ui/public/i18n/en/translation.json @@ -41,7 +41,8 @@ "choose_the_mail_server_to_use": "Choose the domain suffix used for both identifying and initializing the user account and their mail address preferences", "mail_server_is_not_valid": "This mail server cannot be used by Roundcube webmail", "upload_max_filesize_number_lte": "Must be less than 120 MB", - "no_available_mail_domain_check_users": "No available mail domain, please check if users are added from user domain" + "no_available_mail_domain_check_users": "No available mail domain, please check if users are added from user domain", + "mail_module_misconfigured": "Mail module is misconfigured" }, "about": { "title": "About" From ac2e16123881664c7b262763f2f8319a283cf0d4 Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Tue, 6 Feb 2024 11:25:45 +0100 Subject: [PATCH 8/8] Update mail domain error messages --- ui/public/i18n/en/translation.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/public/i18n/en/translation.json b/ui/public/i18n/en/translation.json index a01bb4a..02f5f44 100644 --- a/ui/public/i18n/en/translation.json +++ b/ui/public/i18n/en/translation.json @@ -41,8 +41,8 @@ "choose_the_mail_server_to_use": "Choose the domain suffix used for both identifying and initializing the user account and their mail address preferences", "mail_server_is_not_valid": "This mail server cannot be used by Roundcube webmail", "upload_max_filesize_number_lte": "Must be less than 120 MB", - "no_available_mail_domain_check_users": "No available mail domain, please check if users are added from user domain", - "mail_module_misconfigured": "Mail module is misconfigured" + "no_available_mail_domain_check_users": "Make sure the mail domain you intend to use has \"Add user addresses from user domain\" checkbox enabled", + "mail_module_misconfigured": "No mail domain available" }, "about": { "title": "About"