Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1159
diff -u -9 -p -r1.1159 user.module
--- modules/user/user.module	13 Apr 2010 15:23:03 -0000	1.1159
+++ modules/user/user.module	14 Apr 2010 20:45:36 -0000
@@ -1083,19 +1083,19 @@ function user_account_form_validate($for
       elseif ((bool) db_select('users')->fields('users', array('uid'))->condition('uid', $account->uid, '<>')->condition('name', db_like($form_state['values']['name']), 'LIKE')->range(0, 1)->execute()->fetchField()) {
         form_set_error('name', t('The name %name is already taken.', array('%name' => $form_state['values']['name'])));
       }
     }
 
     // Validate the e-mail address, and check if it is taken by an existing user.
     if ($error = user_validate_mail($form_state['values']['mail'])) {
       form_set_error('mail', $error);
     }
-    elseif ((bool) db_select('users')->fields('users', array('uid'))->condition('uid', $account->uid, '<>')->condition('mail', db_like($form_state['values']['mail']), 'LIKE')->range(0, 1)->execute()->fetchField()) {
+    elseif (variable_get('user_mail_unique', TRUE) && (bool) db_select('users')->fields('users', array('uid'))->condition('uid', $account->uid, '<>')->condition('mail', db_like($form_state['values']['mail']), 'LIKE')->range(0, 1)->execute()->fetchField()) {
       // Format error message dependent on whether the user is logged in or not.
       if ($GLOBALS['user']->uid) {
         form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => $form_state['values']['mail'])));
       }
       else {
         form_set_error('mail', t('The e-mail address %email is already registered. <a href="@password">Have you forgotten your password?</a>', array('%email' => $form_state['values']['mail'], '@password' => url('user/password'))));
       }
     }
 
Index: modules/user/user.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v
retrieving revision 1.69
diff -u -9 -p -r1.69 user.pages.inc
--- modules/user/user.pages.inc	13 Apr 2010 15:13:41 -0000	1.69
+++ modules/user/user.pages.inc	14 Apr 2010 20:45:36 -0000
@@ -50,39 +50,39 @@ function user_pass() {
   }
   $form['submit'] = array('#type' => 'submit', '#value' => t('E-mail new password'));
 
   return $form;
 }
 
 function user_pass_validate($form, &$form_state) {
   $name = trim($form_state['values']['name']);
   // Try to load by email.
-  $users = user_load_multiple(array(), array('mail' => $name, 'status' => '1'));
-  $account = reset($users);
-  if (!$account) {
+  $accounts = user_load_multiple(array(), array('mail' => $name, 'status' => '1'));
+  if (!$accounts) {
     // No success, try to load by name.
-    $users = user_load_multiple(array(), array('name' => $name, 'status' => '1'));
-    $account = reset($users);
+    $accounts = user_load_multiple(array(), array('name' => $name, 'status' => '1'));
   }
-  if (isset($account->uid)) {
-    form_set_value(array('#parents' => array('account')), $account, $form_state);
+  if ($accounts) {
+    form_set_value(array('#parents' => array('accounts')), $accounts, $form_state);
   }
   else {
     form_set_error('name', t('Sorry, %name is not recognized as a user name or an e-mail address.', array('%name' => $name)));
   }
 }
 
 function user_pass_submit($form, &$form_state) {
   global $language;
 
-  $account = $form_state['values']['account'];
-  // Mail one time login URL and instructions using current language.
-  _user_mail_notify('password_reset', $account, $language);
+  $accounts = $form_state['values']['accounts'];
+  foreach ($accounts as $account) {
+    // Mail one time login URL and instructions using current language.
+    _user_mail_notify('password_reset', $account, $language);
+  }
   watchdog('user', 'Password reset instructions mailed to %name at %email.', array('%name' => $account->name, '%email' => $account->mail));
   drupal_set_message(t('Further instructions have been sent to your e-mail address.'));
 
   $form_state['redirect'] = 'user';
   return;
 }
 
 /**
  * Menu callback; process one time login link and redirects to the user page on success.
