Any one know why this would be? It's not a big deal, just have to make sure users log in twice before they get roles...
Thanks

Comments

smerrill’s picture

I can also confirm that this is the case using the same setup.

I'd like to take people to an instructions page (using login_destination) based on their role the first time they log in, but instead I'm going to have to make a page for authenticated user, and then take tell them to log out and then back in.

(I even tried some hacking inside of _ldapauth_save_user(), including hardcoding 'roles' values into $userinfo, but to no avail.)

Any help on this would be greatly appreciated - I love using LDAP auth, and it works perfectly after the second login.

Thank you.

hoyaemt’s picture

I discovered that the 'ldap_config' attribute is set in the $user variable on subsequent logins but NOT on the initial login when the user is created the first time. I solved this by modifying _ldapauth_save_user() in ldapauth.module.

Original line:

$userinfo = array('name' => $login_string, 'pass' => $pass, 'mail' => $mail, 'init' => $init, 'status' => 1, 'authname_ldapauth' => $login_string, 'ldap_authentified' => TRUE, 'ldap_dn' => $dn);

New line:

$userinfo = array('name' => $login_string, 'pass' => $pass, 'mail' => $mail, 'init' => $init, 'status' => 1, 'authname_ldapauth' => $login_string, 'ldap_authentified' => TRUE, 'ldap_dn' => $dn, 'ldap_config' => $ldapauth_ldap->getOption('name'));

Farther down in the function, you'll see that this is being done unconditionally anyway:

$config_name = $ldapauth_ldap->getOption('name');
$userinfo = array('mail' => $mail, 'ldap_dn' => $dn, 'ldap_config' => $config_name);

Therefore, it's probably a bug that needs to be fixed by simply adding 'ldap_config' to the $user variable at the beginning of the function. Hopefully this helps!

kpm’s picture

Component: Miscellaneous » Code
Category: support » bug

Thanks that seems to have done the trick for me.
I'll switch this over to 'bug' rather than support.

junyor’s picture

Duplicate of http://drupal.org/node/171092, I believe.

johnbarclay’s picture

Status: Active » Closed (won't fix)

Closing 5.x issues to clean out issue queue.