? README.txt
Index: email_registration.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/email_registration/email_registration.module,v
retrieving revision 1.5.2.11
diff -u -p -r1.5.2.11 email_registration.module
--- email_registration.module	14 Jul 2009 00:45:00 -0000	1.5.2.11
+++ email_registration.module	28 Aug 2009 14:46:44 -0000
@@ -45,7 +45,7 @@ function email_registration_user($op, &$
 
       // if email verification is off and a new user is the one creating account, log the new user in with correct name
       global $user;
-      if (!variable_get('user_email_verification', 1) && $user->uid == 0) {  
+      if (!variable_get('user_email_verification', 1) && $user->uid == 0) {
         $user = $account;
         $user->name = $namenew;
       }
@@ -100,7 +100,14 @@ function email_registration_form_alter(&
  */
 function email_registration_user_login_validate($form, &$form_state) {
   if (isset($form_state['values']['name'])) {
-    if ($name = db_result(db_query("SELECT name FROM {users} WHERE LOWER(mail) = LOWER('%s')", $form_state['values']['name']))) {
+    // Allow overriding of a slow query.  See README.txt for usage.
+    if (variable_get('email_registration_alternate_query', FALSE)) {
+      $query = variable_get('email_registration_alternate_query', "SELECT name FROM {users} WHERE lower(mail) = lower('%s')");
+    }
+    else {
+      $query = "SELECT name FROM {users} WHERE lower(mail) = lower('%s')";
+    }
+    if ($name = db_result(db_query($query, $form_state['values']['name']))) {
       $form_state['values']['name'] = $name;
     }
   }
