From IRC #drupal

AjK - February 4, 2008 - 21:08
Project:Site Network
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:brmassa
Status:closed
Description

[04-20:58] <clouseau> ajk^: ok; it looked to me like $key was rather hosed in line 68

#1

AjK - February 4, 2008 - 21:39

Just some notes on the history of this for my sanity! (for when I get back to looking at this so I don't forget).

http://drupal.org/node/148419#comment-563959 ....

+function drupal_form_alter(&$form, $form_state, $form_id) {
+  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
+    // Splice in our validate handler for authentication if user is performing a distributed login.
+    // Remove the local authentication handler added by user.module
+    if (!empty($form_state['post']['name']) && drupal_is_distributed_login($form_state['post']['name'])) {
+      $key = array_search('user_login_authenticate_validate', $form['#validate']);
+      unset($form['validate'][$key]);
+      array_splice($form['#validate'], 1, 0, array('drupal_distributed_validate'));
+    }
+  }
+}

but then in http://drupal.org/node/148419#comment-563964 Moshe change that to be

+function drupal_form_alter(&$form, $form_state, $form_id) {
+  if ($form_id == 'user_login_block' || $form_id == 'user_login') {
+    // Splice in our validate handler for authentication if user is performing a distributed login.
+    // Remove the local authentication handler added by user.module
+    if (!empty($form_state['post']['name']) && drupal_is_distributed_login($form_state['post']['name'])) {
+      $key = array_search('user_login_authenticate_validate', $form['#validate']);
+      $form['#validate']['key'] = 'drupal_distributed_validate';
+    }
+  }
+}

Seems clear that the first patch was correct and the second patch moved away from getting it right.

#2

jvandyk - February 4, 2008 - 22:51

I think you want $form['#validate'][$key] = 'drupal_distributed_validate' in the second one. Note, though, that this approach will fail if another module has form_alter'd the 'user_login_authenticate_validate' out of $form['#validate']. Better to test if $key === FALSE before making the assignment.

#3

brmassa - July 31, 2008 - 05:43
Version:<none>» 6.x-1.x-dev
Assigned to:Anonymous» brmassa

Guys,

the module is now ported to D6.

regards,

massa

#4

brmassa - July 31, 2008 - 05:55
Status:active» fixed

#5

Anonymous (not verified) - August 14, 2008 - 05:56
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.