Mercurial > gemma
comparison pkg/controllers/importconfig.go @ 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 | ffc8fb059d1a |
children | 8af156928a2d |
comparison
equal
deleted
inserted
replaced
3553:869505c5087b | 3554:efa468653d48 |
---|---|
100 session, _ := auth.GetSession(req) | 100 session, _ := auth.GetSession(req) |
101 // When a password is stored it doesn't get retransmitted to the client | 101 // When a password is stored it doesn't get retransmitted to the client |
102 // in order to prevent password leakage | 102 // in order to prevent password leakage |
103 // When the user changes the import configuration without a new password | 103 // When the user changes the import configuration without a new password |
104 // the old password should be conserved | 104 // the old password should be conserved |
105 oldPasswd := pc.Attributes["password"] | 105 oldPasswd, ok := pc.Attributes["password"] |
106 pc.User = session.User | 106 pc.User = session.User |
107 pc.Attributes = common.Attributes{} | 107 pc.Attributes = common.Attributes{} |
108 pc.Attributes["password"] = oldPasswd | 108 if ok == true { |
109 pc.Attributes["password"] = oldPasswd | |
110 } | |
109 pc.Attributes.Marshal(config) // Marshal only overwrites keys present in config | 111 pc.Attributes.Marshal(config) // Marshal only overwrites keys present in config |
110 cron, newCron := pc.Attributes.Get("cron") | 112 cron, newCron := pc.Attributes.Get("cron") |
111 | 113 |
112 var tx *sql.Tx | 114 var tx *sql.Tx |
113 if tx, err = conn.BeginTx(ctx, nil); err != nil { | 115 if tx, err = conn.BeginTx(ctx, nil); err != nil { |