diff options
Diffstat (limited to 'internal/auth')
-rw-r--r-- | internal/auth/ldap/config.go | 2 | ||||
-rw-r--r-- | internal/auth/ldap/provider.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/internal/auth/ldap/config.go b/internal/auth/ldap/config.go index 155d161a..db666cde 100644 --- a/internal/auth/ldap/config.go +++ b/internal/auth/ldap/config.go @@ -193,7 +193,7 @@ func bindUser(l *ldap.Conn, userDN, passwd string) error { // searchEntry searches an LDAP source if an entry (name, passwd) is valid and in the specific filter. func (c *Config) searchEntry(name, passwd string, directBind bool) (string, string, string, string, bool, bool) { // See https://tools.ietf.org/search/rfc4513#section-5.1.2 - if len(passwd) == 0 { + if passwd == "" { log.Trace("authentication failed for '%s' with empty password", name) return "", "", "", "", false, false } diff --git a/internal/auth/ldap/provider.go b/internal/auth/ldap/provider.go index a42baa71..9cceed47 100644 --- a/internal/auth/ldap/provider.go +++ b/internal/auth/ldap/provider.go @@ -32,10 +32,10 @@ func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount, return nil, auth.ErrBadCredentials{Args: map[string]interface{}{"login": login}} } - if len(username) == 0 { + if username == "" { username = login } - if len(email) == 0 { + if email == "" { email = fmt.Sprintf("%s@localhost", username) } |