I want to let my active directory users to change their passwords from a linked form with PHP code. when I used ldap_modify function, it changes the mail but it never change the password, however it replied with success message. I use this to encrypt the password:
$encoded_newPassword = "{SHA}" . base64_encode( pack( "H*", sha1( $newPassword ) ) );
To do a password change, you need to follow the procedure and format described in the documentation for the
unicodePwdattribute. You have to do two operations in the same request:And both passwords have to be in a specific format.
To do this in PHP, you use
ldap_modify_batch. In the documentation forldap_modify_batchthere is an example of how to do a password change: