0

I'm writing an application that checks via the adLdap library if the user is logged in.

But the problem is that when the user enters the wrong password, after the 4th time it will lock his account. Is there anything i can do about it? Or is this the way LDAP is working?

Here is the code i'm using:

public static function checkLogin ($username, $password) {
    $ldap = new adLDAP();
    if ($ldap->authenticate($username, $password)) {
        return true;
    }
    return false;
}
Gabriel
  • 1,820
  • 2
  • 23
  • 31

2 Answers2

0

It is not adLDAP nor LDAP that is locking the account. Your network administrator has set up several rules in Windows Active Directory and one of which is to lock the account after 4 incorrect password attempts.

This is a security feature which can only be changed within ADUC (Active Directory Users and Computers).

MonkeyZeus
  • 20,375
  • 4
  • 36
  • 77
-1

I never used the LDAP, but I solve this problem as follows:

When loading the index of the site, would create a $ _SESSION ['count'] to count how many attempts were made to login. If at any time this number exceeds 4 attempts, I give an UPDATE on the database to lock the user's password.

See the example:

public static function checkLogin ($username, $password) {
    if($_SESSION['count'] >= 4 || $this->UserLocked()) {
        return false; //User Locked | note that even created a method to check whether the user is locked or not.
    } else {
        $ldap = new adLDAP();
        if ($ldap->authenticate($username, $password)) {
            return true;
        }

        $_SESSION['count']++;

        return false;
    }
}
Ronald Araújo
  • 1,395
  • 4
  • 19
  • 30