Factoring the model user and correcting password

This commit is contained in:
Chris Mann 2023-07-22 08:35:39 +02:00
parent b900c74423
commit 5a9a5b647c
2 changed files with 8 additions and 0 deletions

View file

@ -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{

View file

@ -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]