Factoring the model user and correcting password
This commit is contained in:
parent
2cc58a6e09
commit
b900c74423
2 changed files with 5 additions and 2 deletions
4
login.go
4
login.go
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue