diff --git a/docs-core/src/main/java/com/sismics/docs/core/constant/ConfigType.java b/docs-core/src/main/java/com/sismics/docs/core/constant/ConfigType.java index e5b2f9d0..bf51a703 100644 --- a/docs-core/src/main/java/com/sismics/docs/core/constant/ConfigType.java +++ b/docs-core/src/main/java/com/sismics/docs/core/constant/ConfigType.java @@ -40,6 +40,7 @@ public enum ConfigType { INBOX_ENABLED, INBOX_HOSTNAME, INBOX_PORT, + INBOX_STARTTLS, INBOX_USERNAME, INBOX_PASSWORD, INBOX_FOLDER, diff --git a/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java b/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java index 7b20dde1..58a0cea3 100644 --- a/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java +++ b/docs-core/src/main/java/com/sismics/docs/core/service/InboxService.java @@ -159,6 +159,7 @@ public class InboxService extends AbstractScheduledService { String port = ConfigUtil.getConfigStringValue(ConfigType.INBOX_PORT); properties.put("mail.imap.host", ConfigUtil.getConfigStringValue(ConfigType.INBOX_HOSTNAME)); properties.put("mail.imap.port", port); + properties.setProperty("mail.imap.starttls.enable", ConfigUtil.getConfigStringValue(ConfigType.INBOX_STARTTLS).toString()); boolean isSsl = "993".equals(port); properties.put("mail.imap.ssl.enable", String.valueOf(isSsl)); properties.setProperty("mail.imap.socketFactory.class", diff --git a/docs-core/src/main/resources/config.properties b/docs-core/src/main/resources/config.properties index f3f5b18d..efbd44c8 100644 --- a/docs-core/src/main/resources/config.properties +++ b/docs-core/src/main/resources/config.properties @@ -1 +1 @@ -db.version=27 \ No newline at end of file +db.version=28 \ No newline at end of file diff --git a/docs-core/src/main/resources/db/update/dbupdate-028-0.sql b/docs-core/src/main/resources/db/update/dbupdate-028-0.sql new file mode 100644 index 00000000..3c37e035 --- /dev/null +++ b/docs-core/src/main/resources/db/update/dbupdate-028-0.sql @@ -0,0 +1,2 @@ +insert into T_CONFIG(CFG_ID_C, CFG_VALUE_C) values('INBOX_STARTTLS', 'false'); +update T_CONFIG set CFG_VALUE_C = '28' where CFG_ID_C = 'DB_VERSION'; diff --git a/docs-web/src/dev/resources/config.properties b/docs-web/src/dev/resources/config.properties index 72a7dafb..4c2a4937 100644 --- a/docs-web/src/dev/resources/config.properties +++ b/docs-web/src/dev/resources/config.properties @@ -1,3 +1,3 @@ api.current_version=${project.version} api.min_version=1.0 -db.version=27 \ No newline at end of file +db.version=28 \ No newline at end of file diff --git a/docs-web/src/main/java/com/sismics/docs/rest/resource/AppResource.java b/docs-web/src/main/java/com/sismics/docs/rest/resource/AppResource.java index 45fc66bd..05908242 100644 --- a/docs-web/src/main/java/com/sismics/docs/rest/resource/AppResource.java +++ b/docs-web/src/main/java/com/sismics/docs/rest/resource/AppResource.java @@ -334,6 +334,7 @@ public class AppResource extends BaseResource { Boolean deleteImported = ConfigUtil.getConfigBooleanValue(ConfigType.INBOX_DELETE_IMPORTED); Config hostnameConfig = configDao.getById(ConfigType.INBOX_HOSTNAME); Config portConfig = configDao.getById(ConfigType.INBOX_PORT); + Boolean starttls = ConfigUtil.getConfigBooleanValue(ConfigType.INBOX_STARTTLS); Config usernameConfig = configDao.getById(ConfigType.INBOX_USERNAME); Config passwordConfig = configDao.getById(ConfigType.INBOX_PASSWORD); Config folderConfig = configDao.getById(ConfigType.INBOX_FOLDER); @@ -353,6 +354,7 @@ public class AppResource extends BaseResource { } else { response.add("port", Integer.valueOf(portConfig.getValue())); } + response.add("starttls", starttls); if (usernameConfig == null) { response.addNull("username"); } else { @@ -425,6 +427,7 @@ public class AppResource extends BaseResource { @FormParam("deleteImported") Boolean deleteImported, @FormParam("hostname") String hostname, @FormParam("port") String portStr, + @FormParam("starttls") Boolean starttls, @FormParam("username") String username, @FormParam("password") String password, @FormParam("folder") String folder, @@ -439,6 +442,7 @@ public class AppResource extends BaseResource { if (!Strings.isNullOrEmpty(portStr)) { ValidationUtil.validateInteger(portStr, "port"); } + ValidationUtil.validateRequired(starttls, "starttls"); // Just update the changed configuration ConfigDao configDao = new ConfigDao(); @@ -451,6 +455,7 @@ public class AppResource extends BaseResource { if (!Strings.isNullOrEmpty(portStr)) { configDao.update(ConfigType.INBOX_PORT, portStr); } + configDao.update(ConfigType.INBOX_STARTTLS, starttls.toString()); if (!Strings.isNullOrEmpty(username)) { configDao.update(ConfigType.INBOX_USERNAME, username); } diff --git a/docs-web/src/main/webapp/src/locale/de.json b/docs-web/src/main/webapp/src/locale/de.json index c2dd0e35..8cc3f790 100644 --- a/docs-web/src/main/webapp/src/locale/de.json +++ b/docs-web/src/main/webapp/src/locale/de.json @@ -440,6 +440,7 @@ "enabled": "Durchsuchen des Posteingangs aktivieren", "hostname": "IMAP-Server", "port": "IMAP-Port (143 oder 993)", + "starttls": "Verwende STARTTLS", "username": "IMAP-Benutzername", "password": "IMAP-Passwort", "folder": "IMAP-Ordner", @@ -449,6 +450,8 @@ "test_success": "Die Verbindung zum Posteingang war erfolgreich ({{ count }} ungelesene {{ count > 1 ? 'Nachrichten' : 'Nachricht' }})", "test_fail": "Beim Verbinden mit dem Posteingang ist ein Fehler aufgetreten, bitte überprüfen Sie die Einstellungen", "saved": "IMAP-Konfiguration erfolgreich gespeichert" + "autoTagsEnabled": "Automatisches Hinzufügen von Tags aus der mit # markierten Betreffzeile", + "deleteImported": "Importierte Nachrichten aus Mailbox löschen" }, "monitoring": { "background_tasks": "Hintergrundaufgaben", diff --git a/docs-web/src/main/webapp/src/locale/en.json b/docs-web/src/main/webapp/src/locale/en.json index cf05bcb4..a6f98f0e 100644 --- a/docs-web/src/main/webapp/src/locale/en.json +++ b/docs-web/src/main/webapp/src/locale/en.json @@ -440,6 +440,7 @@ "enabled": "Enable inbox scanning", "hostname": "IMAP hostname", "port": "IMAP port (143 or 993)", + "starttls": "Enable STARTTLS", "username": "IMAP username", "password": "IMAP password", "folder": "IMAP folder", diff --git a/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html b/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html index 0b1655db..35b81be2 100644 --- a/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html +++ b/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html @@ -45,6 +45,13 @@ +