Index: user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/Attic/user.module,v
retrieving revision 1.612.2.25
diff -u -r1.612.2.25 user.module
--- user.module	11 Dec 2006 19:22:32 -0000	1.612.2.25
+++ user.module	16 Dec 2006 20:36:08 -0000
@@ -1043,11 +1043,15 @@
     '#size' => 30,
     '#maxlength' => 60,
   );
+  if (!variable_get('allow_duplicate_email', 0)){
+// We don't allow user retrieve password by
+// email if email can be duplicate
   $form['mail'] = array('#type' => 'textfield',
     '#title' => t('E-mail address'),
     '#size' => 30,
     '#maxlength' => 64,
   );
+  }
   $form['submit'] = array('#type' => 'submit',
     '#value' => t('E-mail new password'),
     '#weight' => 2,
@@ -1096,7 +1100,11 @@
 }
 
 function theme_user_pass($form) {
-  $output = '<p>'. t('Enter your username <strong><em>or</em></strong> your e-mail address.') .'</p>';
+  if (!variable_get('allow_duplicate_email', 0)){
+    $output = '<p>'. t('Enter your username <strong><em>or</em></strong> your e-mail address.') .'</p>';
+  }else{
+    $output = '<p>'. t('Enter your username.') .'</p>';
+  }
   $output .= form_render($form);
   return $output;
 }
@@ -1373,7 +1381,8 @@
   if ($error = user_validate_mail($edit['mail'])) {
     form_set_error('mail', $error);
   }
-  else if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) {
+  // Checking duplicate email when needs
+  else if (variable_get('allow_duplicate_email', 0) != 1 && db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $uid, $edit['mail'])) > 0) {
     form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => theme('placeholder', $edit['mail']))));
   }
   else if (drupal_is_denied('mail', $edit['mail'])) {
@@ -1988,6 +1997,8 @@
   // User registration settings.
   $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings'));
   $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.')));
+  // We will allow email duplicate when register ?
+  $form['registration']['allow_duplicate_email'] = array('#type' => 'radios', '#title' => t('Allow Duplication of email'), '#description' => t('For testing purpose only, please do not using this on the production.'), '#default_value' => variable_get('allow_duplicate_email', 0), '#options' => array(t('No'), t('Yes')));  
   $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help', ''), '#description' => t('This text is displayed at the top of the user registration form.  It\'s useful for helping or instructing your users.'));
 
   // User e-mail settings.
