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
|
||||
"/admin/ldap_do" }}" method="post">
|
||||
<p>Leave the server empty to disable LDAP.</p>
|
||||
<input
|
||||
type="username"
|
||||
id="bind_user"
|
||||
|
||||
@@ -188,14 +188,11 @@ func (c *Controller) ServeLDAPConfigDo(r *http.Request) *Response {
|
||||
tls := r.FormValue("tls")
|
||||
baseDN := r.FormValue("base_dn")
|
||||
filter := r.FormValue("filter")
|
||||
|
||||
log.Print("AHHH")
|
||||
log.Print(tls)
|
||||
|
||||
if bindUID == "" || bindPSWD == "" || fqdn == "" || port == "" || baseDN == "" || filter == "" {
|
||||
if bindUID == "" || bindPSWD == ""|| port == "" || baseDN == "" || filter == "" {
|
||||
return &Response{
|
||||
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_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"}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user