From ebd6f3734a93179015d37ef0810c59fa2392205a Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Tue, 21 Jul 2026 19:09:42 +0300 Subject: [PATCH] Update: 2026-07-21 19:09:42 --- backend/auth/otp/providers.php | 27 +++++++++++++++++++++------ docker/.env.example | 3 --- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/backend/auth/otp/providers.php b/backend/auth/otp/providers.php index 0fb73745..fd28d636 100644 --- a/backend/auth/otp/providers.php +++ b/backend/auth/otp/providers.php @@ -174,10 +174,26 @@ function sendNabehOtp(string $receiver, string $otp, string $method = '', string if ($response) { $decoded = json_decode($response, true); - if ($decoded && (($decoded['success'] ?? false) || ($decoded['status'] ?? '') === 'success')) { - return true; + error_log("ℹ️ [Nabeh OTP Response] " . $response); + if ($decoded) { + $statusStr = strtolower((string)($decoded['status'] ?? '')); + $msgStr = strtolower((string)($decoded['message'] ?? '')); + if ( + !empty($decoded['success']) || + in_array($statusStr, ['success', 'ok', 'true', '200', 'sent', 'queued', '1'], true) || + ($decoded['status'] ?? false) === true || + ($decoded['code'] ?? 0) === 200 || + !empty($decoded['message_id']) || + !empty($decoded['id']) || + !empty($decoded['token']) || + strpos($msgStr, 'success') !== false || + strpos($msgStr, 'sent') !== false || + strpos($msgStr, 'تم') !== false + ) { + return true; + } } - $msg = "❌ [Nabeh OTP] API returned failure response: " . $response; + $msg = "❌ [Nabeh OTP] API returned failure/unrecognized response: " . $response; error_log($msg); } else { $msg = "❌ [Nabeh OTP] Empty response from cURL."; @@ -217,7 +233,7 @@ function sendIntaleqOtp(string $receiver, string &$otp, string $method = 'whatsa if ($response) { $decoded = json_decode($response, true); - if ($decoded && ($decoded['success'] ?? false)) { + if ($decoded && (!empty($decoded['success']) || ($decoded['status'] ?? '') === 'success')) { if (isset($decoded['otp'])) { $otp = (string)$decoded['otp']; } @@ -225,9 +241,8 @@ function sendIntaleqOtp(string $receiver, string &$otp, string $method = 'whatsa } $msg = "❌ [Intaleq OTP] API returned failure response: " . $response; error_log($msg); - echo $msg; // Temporarily echo the raw error so we can see it in the app logs! } else { - echo "❌ [Intaleq OTP] Empty response or cURL failed."; + error_log("❌ [Intaleq OTP] Empty response or cURL failed."); } return false; } diff --git a/docker/.env.example b/docker/.env.example index f61efdc6..3f0b7772 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -109,9 +109,6 @@ CLAUDAISEFER=zg-qbc-qvo39-vCB-WnzEwFNArO0YlTapvfhtmguKWsXJSKqg_NZSjHBYVXMZK1yUK8 FIREBASE_SERVICE_ACCOUNT_PATH=/var/www/backend/keys/service-account.json RASEEL_DRIVER_INSTANCE_ID=686510D4C41E0 RASEEL_DRIVER_ACCESS_TOKEN=68617b9b8fe53 -SMS_USERNAME=demo_user -SMS_PASSWORD_EGYPT=demo_pass -SMS_SENDER=SiroApp # --- 8. App Signatures & Versions --- APP_SIGNATURE_SERVICE_DEBUG=08c3a281699d01bda0473c5dd33536f89dec2f77da8d45c3ba5285959066fa0e