determining if bind successful

Michael Ströder michael at stroeder.com
Thu May 1 18:03:09 CEST 2003


Michael Engelhart wrote:
> 
> Is there anything in the API that will let you determine whether a 
> particular users login was successful or not?  I'm using simple_bind to 
> bind a user but it appears that if you type in anything, it will accept 
> but just not give access rights.  I want to be able to display a web 
> page after a user tries to login that says "Username/Password were 
> incorrect. please try again."

Mainly if simple_bind_s(who,cred) was successful with a non-empty password 
in cred the "login" was successful. Otherwise one of the following 
exceptions is usually raised:

ldap.INVALID_CREDENTIALS

ldap.INAPPROPRIATE_AUTH

Note the "usual" in the sentence above. Details depend very much on your 
LDAP server (which one?). Many weird things out there...

Ciao, Michael.



More information about the python-ldap mailing list