Can't change password of local users when ldapauth is enabled

costerhout - April 29, 2009 - 16:59
Project:LDAP integration
Version:5.x-1.3
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

When the ldapauth module is enabled I can't change the password of local users. I've checked to make sure there are no users w/ the same username in my Active Directory. I haven't dug much into the code as of yet.

#1

miglius - May 5, 2009 - 17:08
Status:active» closed

Cannot reproduce it. I have created a local drupal user with the ldapauth enabled, then went to that user account page and changed the password. Successfully logged in with the new password.

#2

pianomansam - October 5, 2009 - 23:46
Version:6.x-1.x-dev» 5.x-1.3
Priority:normal» critical

I'm getting this same problem with 5.x-1.3

#3

pianomansam - October 5, 2009 - 23:45
Status:closed» needs review

I've found the error, at least in the 5.x version. On line 792 of ldapauth.module, the module checks to see if the user's account is authentified(sp!) by LDAP. If it is, then it won't display the password fields. The problem is, the line checks against the logged in user, not the user in question! It checks the $user string, which refers to the logged in user, not the user whose profile you are editing. My quick fix was to see if the user_edit form being loaded has a checkbox for being a user that authenticates by LDAP. If the form indicates that, then I disable the password fields. Here's my new code for line 792 in 5.x-1.3:

if ($form['ldap_settings']['ldap_authentified']['#default_value'] != "") {

#4

pianomansam - October 12, 2009 - 20:25

Here's an updated line of code. Seems that the value I used before is only set if you are an admin user. If you aren't, then it still would show the password fields. Here is the updated line of code that works for both admins and regular users.

if ($form['_account']['#value']->ldap_authentified != "") {

 
 

Drupal is a registered trademark of Dries Buytaert.