Index: src/system/classes/accounts/LoginContentControl.inc.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/system/classes/accounts/LoginContentControl.inc.php	(revision 9abce9ace850c29a905389a08fd31065b63b2a7f)
+++ src/system/classes/accounts/LoginContentControl.inc.php	(revision )
@@ -53,63 +53,70 @@
 					$loginSuccess = $authService->authUser($credentials);
 				}
 				
-				if(!$loginSuccess)
+				if($loginSuccess)
 				{
-					$this->v_data_array['GET']['login'] = 'fail';
-					$info_message                       = TEXT_LOGIN_ERROR;
-					$gm_log->gm_track();
-				}
-				else
-				{
 					$email_address = xtc_db_prepare_input($this->v_data_array['POST']['email_address']);
-					
+
 					// Check if email exists
-					$check_customer_query = xtc_db_query("SELECT 
-														customers_id, 
-														customers_password 
-													FROM 
-														" . TABLE_CUSTOMERS . " 
-													WHERE 
-														customers_email_address = '" . xtc_db_input($email_address) . "' 
+					$check_customer_query = xtc_db_query("SELECT
+														customers_id,
+														customers_password
+													FROM
+														" . TABLE_CUSTOMERS . "
+													WHERE
+														customers_email_address = '" . xtc_db_input($email_address) . "'
 														AND account_type = '0'");
-					
+
+					if(xtc_db_num_rows($check_customer_query) > 0)
+					{
-					$check_customer = xtc_db_fetch_array($check_customer_query);
-					
-					// Check if the password needs to be rehashed. 
-					$hash = $authService->getRehashedPassword(new StringType(xtc_db_prepare_input($this->v_data_array['POST']['password'])),
-					                                          new NonEmptyStringType($check_customer['customers_password']));
-					
-					if($hash !== $check_customer['customers_password']
-					   && gm_get_conf('GM_PASSWORD_REENCRYPT') === 'true'
-					)
-					{
-						$db = StaticGXCoreLoader::getDatabaseQueryBuilder();
-						
-						$db->update('customers', ['customers_password' => $hash],
-						            ['customers_email_address' => $email_address]);
-					}
+						$check_customer = xtc_db_fetch_array($check_customer_query);
+
+						// Check if the password needs to be rehashed.
+						$hash = $authService->getRehashedPassword(new StringType(xtc_db_prepare_input($this->v_data_array['POST']['password'])),
+						                                          new NonEmptyStringType($check_customer['customers_password']));
+
+						if($hash !== $check_customer['customers_password']
+						   && gm_get_conf('GM_PASSWORD_REENCRYPT') === 'true'
+						)
+						{
+							$db = StaticGXCoreLoader::getDatabaseQueryBuilder();
+
+							$db->update('customers', ['customers_password' => $hash],
+							            ['customers_email_address' => $email_address]);
+						}
-					
-					$gm_log->gm_delete(true);
-					
-					$this->loginAfterSuccessfulAuthorization($check_customer['customers_id']);
-					
-					if($_SESSION['cart']->count_contents() > 0)
-					{
-						if(isset($this->v_data_array['GET']['checkout_started'])
-						   && $this->v_data_array['GET']['checkout_started'] == 1
-						)
-						{
-							$this->set_redirect_url(xtc_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
-						}
-						else
-						{
-							$this->set_redirect_url(xtc_href_link(FILENAME_ACCOUNT, '', 'SSL'));
-						}
-					}
-					else
-					{
-						$this->set_redirect_url(xtc_href_link(FILENAME_DEFAULT));
-					}
+						$gm_log->gm_delete(true);
+
+						$this->loginAfterSuccessfulAuthorization($check_customer['customers_id']);
+
+						if($_SESSION['cart']->count_contents() > 0)
+						{
+							if(isset($this->v_data_array['GET']['checkout_started'])
+							   && $this->v_data_array['GET']['checkout_started'] == 1
+							)
+							{
+								$this->set_redirect_url(xtc_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
+							}
+							else
+							{
+								$this->set_redirect_url(xtc_href_link(FILENAME_ACCOUNT, '', 'SSL'));
+							}
+						}
+						else
+						{
+							$this->set_redirect_url(xtc_href_link(FILENAME_DEFAULT));
+						}
+					}
+					else
+					{
+
+						$loginSuccess = false;
+					}
+				}
+				if(!$loginSuccess)
+				{
+					$this->v_data_array['GET']['login'] = 'fail';
+					$info_message                       = TEXT_LOGIN_ERROR;
+					$gm_log->gm_track();
 				}
 			}
 		}
