Streamline auth error handling

This commit is contained in:
2023-06-15 12:00:45 +02:00
parent ce199bf320
commit f0685919fd
2 changed files with 6 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ package auth
import (
"errors"
"fmt"
"net/http"
"os"
"strings"
@@ -85,8 +86,8 @@ func (la *LdapAuthenticator) Login(
userDn := strings.Replace(la.config.UserBind, "{username}", user.Username, -1)
if err := l.Bind(userDn, r.FormValue("password")); err != nil {
log.Error("Error while binding to ldap connection")
return nil, err
log.Errorf("AUTH/LOCAL > Authentication for user %s failed: %v", user.Username, err)
return nil, fmt.Errorf("AUTH/LDAP > Authentication failed")
}
return user, nil