Hello,

When LDAP passdord is added to account form for updating, if user updates his account without changing his password, this is deleted in LDAP.

For example, I have two LDAP attributes in "Attribute visibility & access control", mail and password, and when an user changed his mail, and doesn't set any value in password field, the old password is deleted.

My users expect that passwords doesn't change until they fill the appropiate field, and I think it should be the best behaviour.

I propouse that any fields whose type is password should have the same behaviour (fields that you don't read but you need to update anytime), and I added that code in _ldapdata_user_submit function, just before the last "if ($writeout)".


  // avoid unwanted attribute delete if are empty
  // only to 'password' type attributes 
  if ($writeout) {
      $ldapdata_attrs = _ldapdata_ldap_info($user, 'ldapdata_attrs');
      foreach ($ldapdata_attrs as $key => $values){
          array_shift($values);
          if (strtolower(array_shift($values)) == 'password'){
              if ( isset($writeout[$key]) && (trim($writeout[$key]) == '') ){
                  unset($writeout[$key]);
              }
          }
      }
  }

I hope it should be useful for anyone. ;-)