Do not put password in form on modify
This commit is contained in:
parent
19975e981e
commit
7fa2842f5d
3 changed files with 14 additions and 3 deletions
|
@ -65,7 +65,7 @@ func checkTokenAndLog(handler http.Handler) http.Handler {
|
||||||
return
|
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)
|
handler.ServeHTTP(w, r)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
{{$errors := .Errors}}
|
{{$errors := .Errors}}
|
||||||
{{range $i, $schema := .Schema}}
|
{{range $i, $schema := .Schema}}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="{{$schema.Name}}">{{$schema.Description}}</label>
|
<label for="{{$schema.Name}}">{{$schema.Description}}:</label>
|
||||||
{{if $schema.FixedValue}}
|
{{if $schema.FixedValue}}
|
||||||
<input type="text"
|
<input type="text"
|
||||||
disabled="disabled"
|
disabled="disabled"
|
||||||
|
@ -48,6 +48,12 @@
|
||||||
</label>
|
</label>
|
||||||
{{else if $schema.IsPassword}}
|
{{else if $schema.IsPassword}}
|
||||||
<input type="password"
|
<input type="password"
|
||||||
|
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"
|
class="form-control"
|
||||||
name="{{$schema.Name}}"
|
name="{{$schema.Name}}"
|
||||||
id="{{$schema.Name}}"
|
id="{{$schema.Name}}"
|
||||||
|
|
5
web.go
5
web.go
|
@ -262,8 +262,13 @@ func configForm(w http.ResponseWriter, r *http.Request,
|
||||||
|
|
||||||
for _, schema := range data.Schema {
|
for _, schema := range data.Schema {
|
||||||
field := schema.Name
|
field := schema.Name
|
||||||
|
old_value := data.Config[field]
|
||||||
data.Config[field] = strings.Join(r.Form[field], "")
|
data.Config[field] = strings.Join(r.Form[field], "")
|
||||||
|
if schema.IsPassword {
|
||||||
if data.Config[field] == "" {
|
if data.Config[field] == "" {
|
||||||
|
data.Config[field] = old_value
|
||||||
|
}
|
||||||
|
} else if data.Config[field] == "" {
|
||||||
if schema.Required {
|
if schema.Required {
|
||||||
ok = false
|
ok = false
|
||||||
data.Errors[field] = "This field is required"
|
data.Errors[field] = "This field is required"
|
||||||
|
|
Loading…
Reference in a new issue