update
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-04 12:59:01 +11:00
parent ea70e073ec
commit 023fdc22a6
4 changed files with 13 additions and 5 deletions

View File

@@ -123,8 +123,14 @@ func VerifyLdapCreds(username string, password string) bool {
// try to bind to AD
err = ldaps.Bind(username, password)
if err != nil {
log.Printf("VerifyLdapCreds error binding to LDAP with supplied credentials : '%s'\n", err)
return false
if ldapErr, ok := err.(*ldap.Error); ok && ldapErr.ResultCode == ldap.LDAPResultInvalidCredentials {
log.Printf("VerifyLdapCreds user credentials are incorrect\n")
return false
} else {
log.Printf("VerifyLdapCreds error binding to LDAP with supplied credentials : '%s'\n", err)
return false
}
} else {
log.Printf("VerifyLdapCreds successfully bound to LDAP\n")
}