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,
|
DN: login_info.DN,
|
||||||
}, config, l)
|
}, config, l)
|
||||||
|
|
||||||
|
userEntry := ldapUser.UserEntry
|
||||||
|
|
||||||
loginStatus := &LoginStatus{
|
loginStatus := &LoginStatus{
|
||||||
Info: login_info,
|
Info: login_info,
|
||||||
conn: l,
|
conn: l,
|
||||||
UserEntry: ldapUser.UserEntry,
|
UserEntry: userEntry,
|
||||||
CanAdmin: ldapUser.CanAdmin,
|
CanAdmin: ldapUser.CanAdmin,
|
||||||
CanInvite: ldapUser.CanInvite,
|
CanInvite: ldapUser.CanInvite,
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
userEntry := searchRes.Entries[0]
|
||||||
resUser := User{
|
resUser := User{
|
||||||
DN: user.DN,
|
DN: user.DN,
|
||||||
GivenName: searchRes.Entries[0].GetAttributeValue("givenName"),
|
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"),
|
CN: searchRes.Entries[0].GetAttributeValue("cn"),
|
||||||
CanAdmin: strings.EqualFold(user.DN, config.AdminAccount),
|
CanAdmin: strings.EqualFold(user.DN, config.AdminAccount),
|
||||||
CanInvite: true,
|
CanInvite: true,
|
||||||
UserEntry: searchRes.Entries[0],
|
UserEntry: userEntry,
|
||||||
}
|
}
|
||||||
return &resUser, nil
|
return &resUser, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue