From 5a9a5b647c1796ea7cce895b2d310e66ca7c4ddf Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Sat, 22 Jul 2023 08:35:39 +0200 Subject: [PATCH] Factoring the model user and correcting password --- login.go | 5 +++++ model-user.go | 3 +++ 2 files changed, 8 insertions(+) diff --git a/login.go b/login.go index ca5e7aa..e3cf191 100644 --- a/login.go +++ b/login.go @@ -92,6 +92,11 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus { DN: login_info.DN, }, config, l) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return nil + } + userEntry := ldapUser.UserEntry loginStatus := &LoginStatus{ diff --git a/model-user.go b/model-user.go index 6d92186..143eae7 100644 --- a/model-user.go +++ b/model-user.go @@ -45,6 +45,9 @@ func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) { ) searchRes, err := ldapConn.Search(searchReq) if err != nil { + log.Printf("get User : %v", err) + log.Printf("get User : %v", searchReq) + log.Printf("get User : %v", searchRes) return nil, err } userEntry := searchRes.Entries[0]