From 9349eb77cd0807b8207be660e23354f00da272f4 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sat, 19 Apr 2014 22:36:12 +0200 Subject: [PATCH] Let absence of password be absence --- cmd/syncthing/gui.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index b28b1bb5..2951244f 100644 --- a/cmd/syncthing/gui.go +++ b/cmd/syncthing/gui.go @@ -109,7 +109,9 @@ func restGetConnections(m *Model, w http.ResponseWriter) { func restGetConfig(w http.ResponseWriter) { encCfg := cfg - encCfg.GUI.Password = unchangedPassword + if encCfg.GUI.Password != "" { + encCfg.GUI.Password = unchangedPassword + } json.NewEncoder(w).Encode(encCfg) } @@ -119,7 +121,9 @@ func restPostConfig(req *http.Request) { if err != nil { warnln(err) } else { - if cfg.GUI.Password != unchangedPassword { + if cfg.GUI.Password == "" { + // Leave it empty + } else if cfg.GUI.Password != unchangedPassword { hash, err := bcrypt.GenerateFromPassword([]byte(cfg.GUI.Password), 0) if err != nil { warnln(err)