Fixed Change Password Bug

This commit is contained in:
Chris Mann 2023-07-25 15:05:51 +02:00
parent 6033c90d96
commit 9a3f234f9b

View file

@ -15,7 +15,12 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
return nil return nil
} }
session, err := store.Get(r, SESSION_NAME) session, err := store.Get(r, SESSION_NAME)
if err == nil { if err != nil {
log.Printf("checkLogin ldapOpen : %v", err)
log.Printf("checkLogin ldapOpen : %v", session)
log.Printf("checkLogin ldapOpen : %v", session.Values)
return nil
}
username, ok := session.Values["login_username"] username, ok := session.Values["login_username"]
password, ok2 := session.Values["login_password"] password, ok2 := session.Values["login_password"]
user_dn, ok3 := session.Values["login_dn"] user_dn, ok3 := session.Values["login_dn"]
@ -26,12 +31,6 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
Username: username.(string), Username: username.(string),
Password: password.(string), Password: password.(string),
} }
if err != nil {
log.Printf("checkLogin ldapOpen : %v", err)
log.Printf("checkLogin ldapOpen : %v", session)
log.Printf("checkLogin ldapOpen : %v", session.Values)
return nil
}
err = bind(User{ err = bind(User{
DN: login_info.DN, DN: login_info.DN,
Password: login_info.Password, Password: login_info.Password,
@ -48,8 +47,6 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
} }
return checkLogin(w, r) return checkLogin(w, r)
} }
}
}
ldapUser, err := get(User{ ldapUser, err := get(User{
DN: login_info.DN, DN: login_info.DN,
CN: login_info.Username, CN: login_info.Username,
@ -67,6 +64,9 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
CanInvite: ldapUser.CanInvite, CanInvite: ldapUser.CanInvite,
} }
return loginStatus return loginStatus
} else {
return nil
}
} }
/* /*