diff --git a/frontend/src/views/Settings.vue b/frontend/src/views/Settings.vue index e46e43d..2608a54 100644 --- a/frontend/src/views/Settings.vue +++ b/frontend/src/views/Settings.vue @@ -177,7 +177,8 @@ - + @@ -281,7 +282,7 @@ name="username" placeholder="mysmtp" :maxlength="200" /> + message="Enter a value to change."> { + this.$api.updateSettings(form).then((data) => { if (data.needsRestart) { // Update the 'needsRestart' flag on the global serverConfig state // as there are running campaigns and the app couldn't auto-restart. @@ -462,6 +474,14 @@ export default Vue.extend({ // Serialize the `email_headers` array map to display on the form. for (let i = 0; i < d.smtp.length; i += 1) { d.smtp[i].strEmailHeaders = JSON.stringify(d.smtp[i].email_headers, null, 4); + + // The backend doesn't send passwords, so add a dummy so that it + // the password looks filled on the UI. + d.smtp[i].password = dummyPassword; + } + + if (d['upload.provider'] === 's3') { + d['upload.s3.aws_secret_access_key'] = dummyPassword; } this.form = d; diff --git a/handlers.go b/handlers.go index fd84c9a..67908ba 100644 --- a/handlers.go +++ b/handlers.go @@ -124,6 +124,7 @@ func registerHTTPHandlers(e *echo.Echo) { e.GET("/campaigns/media", handleIndexPage) e.GET("/campaigns/templates", handleIndexPage) e.GET("/campaigns/:campignID", handleIndexPage) + e.GET("/settings", handleIndexPage) } // handleIndex is the root handler that renders the Javascript frontend. diff --git a/internal/migrations/v0.7.0.go b/internal/migrations/v0.7.0.go index 2d484cf..871ac15 100644 --- a/internal/migrations/v0.7.0.go +++ b/internal/migrations/v0.7.0.go @@ -66,6 +66,7 @@ func V0_7_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error { -- Insert default settings if the table is empty. INSERT INTO settings (key, value) SELECT k, v::JSONB FROM (VALUES + ('app.root_url', '"http://localhost:9000"'), ('app.favicon_url', '""'), ('app.from_email', '"listmonk "'), ('app.logo_url', '"http://localhost:9000/public/static/logo.png"'), diff --git a/queries.sql b/queries.sql index 62ef264..2ee40f5 100644 --- a/queries.sql +++ b/queries.sql @@ -733,5 +733,5 @@ SELECT JSON_OBJECT_AGG(key, value) AS settings -- name: update-settings UPDATE settings AS s SET value = c.value - -- For each key in the incoming JSON map, update the row with the key and it's value. + -- For each key in the incoming JSON map, update the row with the key and its value. FROM(SELECT * FROM JSONB_EACH($1)) AS c(key, value) WHERE s.key = c.key; diff --git a/settings.go b/settings.go index 1666661..24ad4d8 100644 --- a/settings.go +++ b/settings.go @@ -117,7 +117,7 @@ func handleUpdateSettings(c echo.Context) error { } if !has { return echo.NewHTTPError(http.StatusBadRequest, - "At least one SMTP block should be enabled") + "Minimum one SMTP block should be enabled.") } // S3 password?