[Tested with both Drupal 5 and Drupal 6, using corresponding modules]
When installing SMFForum Integration Module, the LDAP Integration stops quering the LDAP server.
When I disable function smfforum_form_alter(&$form, $form_state, $form_id) from smfforum.module, LDAP Integration starts working again but (obviously) I'm unable to single sign on towards SMFForum. Tracing down the code a bit further, the issue seems to be related to the line $form['#validate'] = smfforum_login_default_validators();, this function contains:
function smfforum_login_default_validators() {
return array('user_login_name_validate', 'user_login_authenticate_validate',
'smfforum_login_authenticate_validate', 'user_login_authenticate_validate',
'user_login_final_validate');
}
Seems like the login_validators do get rewritten, without a query to LDAP Integration. Does anyone now how to fix this? Or perhaps it's possible to query the current validators?
Comments
Comment #1
mvdschoot commentedChanged
function smfforum_login_default_validators()to:And both LDAP Integration and SMFForum Integration are running during login process. Offcourse this is not the way to go ;)
Still got an error 'The SMF username xxx is not found in SMF. ' and 'Unable to create new SMF user: xxx error: bad email ' on first time login. (User has got a valid email). On second time login, only the error 'The SMF username xxx is not found in SMF' is displayed.
Comment #2
vb commentedWhich module does LDAP Integration in Drupal 6?
With what do you test it.
I have found only ldap_integration 5.x-1.3.
I have seen inside.
I can use needed portion of code but module should be D6.
Comment #3
mvdschoot commentedDrupal 6 version of LDAP Integration can be found at http://drupal.org/project/issues/ldap_integration (Issue Porting to Drupal 6), it's currently still work in progress but the basics are full up & running.
Comment #4
vb commentedI have committed new dev version to HEAD
You can get it from HEAD or wait till next project release
I have changed a lot in the new version and added an attempt to fix this issue.
Sorry, I cannot test LDAP integration because I do not have with what.
But You can play with position of validator ldapauth_login_validate
See
hope it helps you to find the solution
vb
Comment #5
mvdschoot commentedThanks. I will try testing LDAP Integration as soon as possible; But this probably won't be before the beginning of next week. I'll get back with the results!
Comment #6
mvdschoot commentedGot the latest version from HEAD and things are getting much smoother now!
Still one problem left: in smfforum.module, the function smfforum_external_login_register($login, $passwd) is taking care of user registration into SMF? At the moment this function is called, the local user is probably not yet created by ldap_integration; This means no $email is available, resulting in an error.
Just before
if (SMF_MODULE_DEBUG) {at about line 2236, I inserted the following code:And yes indeed, there is at this particular moment no local user created - thus no email available.
As a workaround I created the code:
This works quiet well, the user get registered in SMF but (offcourse) with the wrong email address. This shouldn't be a problem, because the option ' Master registration system' has been configured as 'Drupal Master'. I assume next time login the correct email address will get synched from Drupal to SMF. But, for some reason the (wrong) email address in SMF is immediately getting synchronised back to Drupal.
Merijn
Comment #7
vb commentedOk, thanks, we are on the right way.
Just today in a night dev build I have changed authentication and already fixed an empty email when the user exists in SMF.
It seems you have tried previous build. Try please the latest one.
This function does following main things.
It authorizes user from SMF DB and
It findes or creates user IN DRUPAL and get the user logged in.
The function should not create user in SMF.
It checks if user exists in SMF.
And we should try not to register it in SMF or to understand that it really shoud be done only for LDAP integration.
Comment #8
mvdschoot commentedWhile testing today I used the latest smfforum.module (The one updated about 17 hours ago).
Again did some debugging. Running the original code (Download a couple of minutes ago). Testing with a clean database, no users listed in Drupal and no users available in SMF (Except for the Admin user).
When I turn on some debugging code
the following message is displayed:
SMF user: testuser () pass=testpassword auth in SMF
The SMF username testuser is not found in SMF.
And no user is authenticated and/or created.
Also, when I force the creation of an email address
if (!$email)), the response isSMF user: testuser (testuser@dummy-company.com) pass=testpassword auth in SMF
The SMF username testuser is not found in SMF.
And no user is authenticated and/or created.
Merijn
Comment #9
vb commentedI will think about that and will try to make new ldap auth for testing during this weekend.
Comment #10
vb commentedDrupal 6 module smfforum.module bug fixing updates smfforum-6.x-1.0.zip
can be downloaded from http://vgb.org.ru/download
Fixed vailidation and ldap auth
Comment #11
wangmz commentedThe problem still exists in version 6.x-1.21. In fact, after drilling down the codes, I find there is a redundant checking in file smfforum.module on line 441:
if (module_exists('ldap_integration')) {
function smfforum_ldapauth_login_validate($form, &$form_state) {
global $user;
if (!$user->uid) {
$pass = trim($form_state['values']['pass']);
if (!empty($pass)) {
ldapauth_login_validate($form, $form_state);
}
}
}
}
}
Of course there is no module named "ldap_integration" in the system. Instead, the module is "ldapauth" which is already checked in function smfforum_login_default_validators() of the same file. Why not just define the function smfforum_ldapauth_login_validate() without checking again module_exists('ldap_integration')?
Hope some someone can check the source code again and update it accordingly. Thanks.
Comment #12
vb commentedFind
Replace with