aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server.go2
-rw-r--r--templates/config.html8
-rw-r--r--web.go7
3 files changed, 14 insertions, 3 deletions
diff --git a/server.go b/server.go
index 309ac34..6ec6549 100644
--- a/server.go
+++ b/server.go
@@ -65,7 +65,7 @@ func checkTokenAndLog(handler http.Handler) http.Handler {
return
}
- log.Printf("%s %s %s\n", r.RemoteAddr, r.Method, strings.Split(r.URL, "?")[0])
+ log.Printf("%s %s %s\n", r.RemoteAddr, r.Method, strings.Split(r.URL.String(), "?")[0])
handler.ServeHTTP(w, r)
})
}
diff --git a/templates/config.html b/templates/config.html
index 2d64444..9018811 100644
--- a/templates/config.html
+++ b/templates/config.html
@@ -28,7 +28,7 @@
{{$errors := .Errors}}
{{range $i, $schema := .Schema}}
<div class="form-group">
- <label for="{{$schema.Name}}">{{$schema.Description}}</label>
+ <label for="{{$schema.Name}}">{{$schema.Description}}:</label>
{{if $schema.FixedValue}}
<input type="text"
disabled="disabled"
@@ -51,6 +51,12 @@
class="form-control"
name="{{$schema.Name}}"
id="{{$schema.Name}}"
+ placeholder="(not modified if left empty)" />
+ {{else if $schema.IsNumeric}}
+ <input type="number"
+ class="form-control"
+ name="{{$schema.Name}}"
+ id="{{$schema.Name}}"
value="{{index $config $schema.Name}}" />
{{else}}
<input type="text"
diff --git a/web.go b/web.go
index 9983855..8f64043 100644
--- a/web.go
+++ b/web.go
@@ -262,8 +262,13 @@ func configForm(w http.ResponseWriter, r *http.Request,
for _, schema := range data.Schema {
field := schema.Name
+ old_value := data.Config[field]
data.Config[field] = strings.Join(r.Form[field], "")
- if data.Config[field] == "" {
+ if schema.IsPassword {
+ if data.Config[field] == "" {
+ data.Config[field] = old_value
+ }
+ } else if data.Config[field] == "" {
if schema.Required {
ok = false
data.Errors[field] = "This field is required"