Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a user account is locked via PHP/LDAP?

Tags:

php

ldap

We've created an intranet site that requires the same password as the user's network login, so we use LDAP to check the username/password.

That's fine, but if they enter it incorrectly three times it locks their account out, and one or two users have found this confusing.

Is there anyway at all I could check, using LDAP/PHP whether or not their account is locked, so I can display a little message prompting them to contact IT?

like image 237
Nick Avatar asked Oct 24 '25 02:10

Nick


1 Answers

One of AD profile attribute useraccountcontrol. This contains decimal value which can be converted into readable here;

  • https://support.microsoft.com/en-us/kb/305144
  • http://ananthdeodhar.com/php-active-directory-integration-get-useraccountcontrol-attributes/

Locked can be referring to multiple cases, normally

  • ACCOUNTDISABLE 2 / 0x0002 (hexa)
  • PASSWORD_EXPIRED 8388608 / 0x800000
  • LOCKOUT 16 / 0x0010
like image 72
Ryan Harne Avatar answered Oct 25 '25 16:10

Ryan Harne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!