Addd default value for LDAP config page

This commit is contained in:
BetaPictoris
2023-08-05 22:11:05 -07:00
parent 1fab192195
commit 23e797e62a
4 changed files with 706 additions and 16 deletions

No files matched your search

+18 -1
View File
@@ -160,6 +160,20 @@ func (c *Controller) ServeUnlinkListenBrainzDo(r *http.Request) *Response {
func (c *Controller) ServeLDAPConfig(r *http.Request) *Response {
data := &templateData{}
data.CurrentBindUID, _ = c.DB.GetSetting("ldap_bind_user")
data.CurrentFQDN, _ = c.DB.GetSetting("ldap_fqdn")
data.CurrentPort, _ = c.DB.GetSetting("ldap_port")
data.CurrentBaseDN, _ = c.DB.GetSetting("ldap_base_dn")
data.CurrentFilter, _ = c.DB.GetSetting("ldap_filter")
// This is to fix the fact that select boxes are strange.
currentTLS, _ := c.DB.GetSetting("ldap_tls")
data.CurrentNoTLS = "selected"
if currentTLS == "true" {
data.CurrentNoTLS = ""
}
return &Response{
template: "ldap.tmpl",
data: data,
@@ -175,7 +189,10 @@ func (c *Controller) ServeLDAPConfigDo(r *http.Request) *Response {
baseDN := r.FormValue("base_dn")
filter := r.FormValue("filter")
if bindUID == "" || bindPSWD == "" || fqdn == "" || port == "" || port == "" || baseDN == "" || filter == "" {
log.Print("AHHH")
log.Print(tls)
if bindUID == "" || bindPSWD == "" || fqdn == "" || port == "" || baseDN == "" || filter == "" {
return &Response{
redirect: r.Referer(),
flashW: []string{"please provide a bind username and password, a FQDN, port, base CN, and filter"},