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, DN: login_info.DN,
}, config, l) }, config, l)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return nil
}
userEntry := ldapUser.UserEntry userEntry := ldapUser.UserEntry
loginStatus := &LoginStatus{ loginStatus := &LoginStatus{

View file

@ -45,6 +45,9 @@ func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
) )
searchRes, err := ldapConn.Search(searchReq) searchRes, err := ldapConn.Search(searchReq)
if err != nil { if err != nil {
log.Printf("get User : %v", err)
log.Printf("get User : %v", searchReq)
log.Printf("get User : %v", searchRes)
return nil, err return nil, err
} }
userEntry := searchRes.Entries[0] userEntry := searchRes.Entries[0]