feat(settings/ldap): preserve ReaderDN in database if empty in settings payload (#3537)

* Allows to avoid changing any current value when using LDAP Anonymous Mode
pull/3530/head
Hugo Hromic 5 years ago committed by GitHub
parent 6c492d2290
commit f4c461d7fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -69,11 +69,16 @@ func (handler *Handler) settingsUpdate(w http.ResponseWriter, r *http.Request) *
}
if payload.LDAPSettings != nil {
ldapReaderDN := settings.LDAPSettings.ReaderDN
ldapPassword := settings.LDAPSettings.Password
if payload.LDAPSettings.ReaderDN != "" {
ldapReaderDN = payload.LDAPSettings.ReaderDN
}
if payload.LDAPSettings.Password != "" {
ldapPassword = payload.LDAPSettings.Password
}
settings.LDAPSettings = *payload.LDAPSettings
settings.LDAPSettings.ReaderDN = ldapReaderDN
settings.LDAPSettings.Password = ldapPassword
}

Loading…
Cancel
Save