aboutsummaryrefslogtreecommitdiff
path: root/directory.go
diff options
context:
space:
mode:
Diffstat (limited to 'directory.go')
-rw-r--r--directory.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/directory.go b/directory.go
index 06afdf2..ab5dea3 100644
--- a/directory.go
+++ b/directory.go
@@ -43,7 +43,7 @@ func handleDirectorySearch(w http.ResponseWriter, r *http.Request) {
r.ParseMultipartForm(1024)
input := strings.TrimSpace(strings.Join(r.Form["query"], ""))
- if r.Method != "POST" || input == "" {
+ if r.Method != "POST" {
http.Error(w, "Invalid request", http.StatusBadRequest)
return
}
@@ -79,7 +79,8 @@ func handleDirectorySearch(w http.ResponseWriter, r *http.Request) {
results := []SearchResult{}
for _, values := range sr.Entries {
- if ContainsI(values.GetAttributeValue(config.UserNameAttr), input) ||
+ if input == "" ||
+ ContainsI(values.GetAttributeValue(config.UserNameAttr), input) ||
ContainsI(values.GetAttributeValue("displayname"), input) ||
ContainsI(values.GetAttributeValue("mail"), input) {
results = append(results, SearchResult{