Log the LDAP connection

This commit is contained in:
Yohann D'ANELLO 2021-01-08 22:56:19 +01:00
parent ee16bf9e21
commit 79f52ed880
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 2 additions and 0 deletions

View File

@ -42,8 +42,10 @@ func (a LDAP) Login(username string, password string) (bool, string, error) {
for _, username := range potentialUsernames {
// Try to bind as user
bindDn := "cn=" + username + "," + a.Cfg.UserDn
log.Printf("[LDAP] Logging to %s...", bindDn)
err = a.Conn.Bind(bindDn, password)
if err == nil {
log.Printf("[LDAP] Logging failed: %s", err)
// Login succeeded if no error
return true, aliasSplit[0], nil
}