如何在不锁定帐户的情况下验证用户身份?

时间:2013-08-14 09:15:06

标签: php adldap

我正在编写一个应用程序,如果用户已登录,则通过adLdap库进行检查。

但问题是,当用户输入错误的密码时,第4次后会锁定他的帐户。我能做些什么吗?或者这是LDAP的工作方式吗?

以下是我正在使用的代码:

public static function checkLogin ($username, $password) {
    $ldap = new adLDAP();
    if ($ldap->authenticate($username, $password)) {
        return true;
    }
    return false;
}

2 个答案:

答案 0 :(得分:0)

锁定帐户不是adLDAP,也不是LDAP。您的网络管理员已在Windows Active Directory中设置了多个规则,其中一个规则是在4次密码尝试失败后锁定帐户。

这是一项安全功能,只能在ADUC(Active Directory用户和计算机)中进行更改。

答案 1 :(得分:-1)

我从未使用过LDAP,但我按如下方式解决了这个问题:

加载网站索引时,会创建$ _SESSION ['count']来计算登录尝试次数。如果此数字超过4次尝试,我会在数据库上提供UPDATE以锁定用户的密码。

参见示例:

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;
    }
}
相关问题