Factoring the model user and correcting password

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

View file

@ -92,10 +92,12 @@ func checkLogin(w http.ResponseWriter, r *http.Request) *LoginStatus {
DN: login_info.DN,
}, config, l)
userEntry := ldapUser.UserEntry
loginStatus := &LoginStatus{
Info: login_info,
conn: l,
UserEntry: ldapUser.UserEntry,
UserEntry: userEntry,
CanAdmin: ldapUser.CanAdmin,
CanInvite: ldapUser.CanInvite,
}

View file

@ -47,6 +47,7 @@ func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
if err != nil {
return nil, err
}
userEntry := searchRes.Entries[0]
resUser := User{
DN: user.DN,
GivenName: searchRes.Entries[0].GetAttributeValue("givenName"),
@ -56,7 +57,7 @@ func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
CN: searchRes.Entries[0].GetAttributeValue("cn"),
CanAdmin: strings.EqualFold(user.DN, config.AdminAccount),
CanInvite: true,
UserEntry: searchRes.Entries[0],
UserEntry: userEntry,
}
return &resUser, nil
}