changeset 3554:efa468653d48

only write password attribute, when available previous
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 31 May 2019 14:48:47 +0200
parents 869505c5087b
children 76eafbf0a98d
files pkg/controllers/importconfig.go
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/importconfig.go	Fri May 31 14:32:24 2019 +0200
+++ b/pkg/controllers/importconfig.go	Fri May 31 14:48:47 2019 +0200
@@ -102,10 +102,12 @@
 	// in order to prevent password leakage
 	// When the user changes the import configuration without a new password
 	// the old password should be conserved
-	oldPasswd := pc.Attributes["password"]
+	oldPasswd, ok := pc.Attributes["password"]
 	pc.User = session.User
 	pc.Attributes = common.Attributes{}
-	pc.Attributes["password"] = oldPasswd
+	if ok == true {
+		pc.Attributes["password"] = oldPasswd
+	}
 	pc.Attributes.Marshal(config) // Marshal only overwrites keys present in config
 	cron, newCron := pc.Attributes.Get("cron")