From 410fb14d7764a4909565f5f644b26b44ada1286a Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Fri, 31 Jul 2026 19:21:38 +0300 Subject: [PATCH] Update: 2026-07-31 19:21:38 --- .../driver/loginUsingCredentialsWithoutGoogle.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/auth/driver/loginUsingCredentialsWithoutGoogle.php b/backend/auth/driver/loginUsingCredentialsWithoutGoogle.php index 0f2d1984..9c258124 100644 --- a/backend/auth/driver/loginUsingCredentialsWithoutGoogle.php +++ b/backend/auth/driver/loginUsingCredentialsWithoutGoogle.php @@ -52,12 +52,19 @@ try { FROM driver LEFT JOIN phone_verification ON phone_verification.phone_number = driver.phone_key LEFT JOIN CarRegistration ON CarRegistration.driverID = driver.id - WHERE - driver.email = :email OR (:email_bidx IS NOT NULL AND driver.email_bidx = :email_bidx) - LIMIT 1"; + WHERE driver.email = :email"; + + $params = [':email' => $encryptedEmail]; + + if ($emailBidx !== null) { + $sql .= " OR driver.email_bidx = :email_bidx"; + $params[':email_bidx'] = $emailBidx; + } + + $sql .= " LIMIT 1"; $stmt = $con->prepare($sql); - $stmt->execute([':email' => $encryptedEmail, ':email_bidx' => $emailBidx]); + $stmt->execute($params); $data = $stmt->fetch(PDO::FETCH_ASSOC);