Added a way of disabling LDAP auth
This commit is contained in:
No files matched your search
@@ -7,6 +7,7 @@
|
|||||||
) }}
|
) }}
|
||||||
<form class="flex flex-col gap-2 items-end" action="{{ path
|
<form class="flex flex-col gap-2 items-end" action="{{ path
|
||||||
"/admin/ldap_do" }}" method="post">
|
"/admin/ldap_do" }}" method="post">
|
||||||
|
<p>Leave the server empty to disable LDAP.</p>
|
||||||
<input
|
<input
|
||||||
type="username"
|
type="username"
|
||||||
id="bind_user"
|
id="bind_user"
|
||||||
|
|||||||
@@ -189,13 +189,10 @@ func (c *Controller) ServeLDAPConfigDo(r *http.Request) *Response {
|
|||||||
baseDN := r.FormValue("base_dn")
|
baseDN := r.FormValue("base_dn")
|
||||||
filter := r.FormValue("filter")
|
filter := r.FormValue("filter")
|
||||||
|
|
||||||
log.Print("AHHH")
|
if bindUID == "" || bindPSWD == ""|| port == "" || baseDN == "" || filter == "" {
|
||||||
log.Print(tls)
|
|
||||||
|
|
||||||
if bindUID == "" || bindPSWD == "" || fqdn == "" || port == "" || baseDN == "" || filter == "" {
|
|
||||||
return &Response{
|
return &Response{
|
||||||
redirect: r.Referer(),
|
redirect: r.Referer(),
|
||||||
flashW: []string{"please provide a bind username and password, a FQDN, port, base CN, and filter"},
|
flashW: []string{"please provide a bind username and password, port, base CN, and filter"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,6 +205,13 @@ func (c *Controller) ServeLDAPConfigDo(r *http.Request) *Response {
|
|||||||
c.DB.SetSetting("ldap_base_dn", baseDN)
|
c.DB.SetSetting("ldap_base_dn", baseDN)
|
||||||
c.DB.SetSetting("ldap_filter", filter)
|
c.DB.SetSetting("ldap_filter", filter)
|
||||||
|
|
||||||
|
if fqdn == "" {
|
||||||
|
return &Response{
|
||||||
|
redirect: "/admin/home",
|
||||||
|
flashW: []string{"LDAP server was left empty, LDAP authentication will be disabled."},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return &Response{redirect: "/admin/home"}
|
return &Response{redirect: "/admin/home"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user