--- /sites/all/modules/ubercart/uc_cart/uc_cart_checkout_pane.inc	Tue Oct 26 20:26:40 2010
+++ /sites/all/modules/ubercart/uc_cart/uc_cart_checkout_pane.inc	Tue Oct 26 20:26:29 2010
@@ -148,15 +148,17 @@
       }
       unset($_SESSION['email_match']);
 
+      // Invalidate if an account already exists for this e-mail address, and the user is not logged into that account
+      if ($user->uid == 0 && !empty($arg2['primary_email'])) {
+        if (db_result(db_query("SELECT uid FROM {users} WHERE LOWER(mail) = LOWER('%s')", $arg2['primary_email'])) > 0) {
+          form_set_error('panes][customer][primary_email', t('An account already exists for your e-mail address. You will either need to login with with this e-mail address or use a different e-mail address.'));
+        }
+      }
+
       // If new users can specify names or passwords then...
       if ((variable_get('uc_cart_new_account_name', FALSE) ||
           variable_get('uc_cart_new_account_password', FALSE)) &&
           $user->uid == 0) {
-        // Skip if an account already exists for this e-mail address.
-        if (db_fetch_object(db_query("SELECT uid FROM {users} WHERE LOWER(mail) = LOWER('%s')", $arg2['primary_email'])) > 0) {
-          drupal_set_message(t('An account already exists for your e-mail address. The new account details you entered will be disregarded.'));
-        }
-        else {
           // Validate the username.
           if (variable_get('uc_cart_new_account_name', FALSE) && !empty($arg2['new_account']['name'])) {
             $message = user_validate_name($arg2['new_account']['name']);
@@ -174,7 +176,6 @@
               form_set_error('panes][customer][new_account][pass_confirm', t('The passwords you entered did not match. Please try again.'));
             }
             $arg1->data['new_user']['pass'] = $arg2['new_account']['pass'];
-          }
         }
       }
 
