This commit is contained in:
@@ -123,12 +123,14 @@ func VerifyLdapCreds(username string, password string) bool {
|
||||
|
||||
defer ldaps.Close()
|
||||
|
||||
ldaps.Debug = true
|
||||
|
||||
// try to bind to AD
|
||||
log.Printf("Attempting LDAP bind with user '%s' and password '%s'\n", username, password)
|
||||
err = ldaps.Bind(username, password)
|
||||
if err != nil {
|
||||
if ldapErr, ok := err.(*ldap.Error); ok && ldapErr.ResultCode == ldap.LDAPResultInvalidCredentials {
|
||||
log.Printf("VerifyLdapCreds user credentials are incorrect\n")
|
||||
log.Printf("VerifyLdapCreds user credentials are incorrect : '%s'\n", err)
|
||||
return false
|
||||
} else {
|
||||
log.Printf("VerifyLdapCreds error binding to LDAP with supplied credentials : '%s'\n", err)
|
||||
|
Reference in New Issue
Block a user