Update: 2026-06-23 17:42:09

This commit is contained in:
Hamza-Ayed
2026-06-23 17:42:09 +03:00
parent 148ca3af1d
commit 52c4f96976
3 changed files with 12 additions and 38 deletions

View File

@@ -92,47 +92,19 @@ switch (strtolower($country)) {
case 'egypt': case 'egypt':
$sentSuccessfully = sendKazumiSms($receiver, $otp); $sentSuccessfully = sendKazumiSms($receiver, $otp);
if (!$sentSuccessfully) { if (!$sentSuccessfully) {
error_log("⚠️ [Egypt OTP Failover 1] Kazumi SMS failed. Falling back to Intaleq OTP WhatsApp."); error_log("⚠️ [Egypt OTP Failover] Kazumi SMS failed. Falling back to Intaleq OTP WhatsApp.");
$sentSuccessfully = sendIntaleqOtp($receiver, $otp, 'whatsapp'); $sentSuccessfully = sendIntaleqOtp($receiver, $otp, 'whatsapp');
if (!$sentSuccessfully) {
error_log("⚠️ [Egypt OTP Failover 2] Intaleq OTP WhatsApp failed. Falling back to Nabeh JWT OTP text.");
$sentSuccessfully = sendNabehOtp($receiver, $otp, 'text');
}
} }
break; break;
case 'syria': case 'syria':
// Syria uses dynamic Nabeh JWT for voice/image, static Intaleq app_key for whatsapp/sms // Syria uses Intaleq app_key for whatsapp/sms
if ($method === 'bearer_send' || $method === 'voice' || $method === 'image') {
$sentSuccessfully = sendNabehOtp($receiver, $otp, $method);
if (!$sentSuccessfully) {
error_log("⚠️ [Syria OTP Failover] Nabeh JWT method failed. Falling back to Intaleq OTP WhatsApp.");
$sentSuccessfully = sendIntaleqOtp($receiver, $otp, 'whatsapp');
}
} else {
$sentSuccessfully = sendIntaleqOtp($receiver, $otp, $method ?: 'whatsapp'); $sentSuccessfully = sendIntaleqOtp($receiver, $otp, $method ?: 'whatsapp');
if (!$sentSuccessfully) {
error_log("⚠️ [Syria OTP Failover] Intaleq OTP WhatsApp failed. Falling back to Nabeh JWT OTP text.");
$sentSuccessfully = sendNabehOtp($receiver, $otp, 'text');
}
}
break; break;
case 'jordan': case 'jordan':
// Jordan uses dynamic Nabeh JWT for voice/image, static Intaleq app_key for sms/whatsapp // Jordan uses Intaleq app_key for whatsapp/sms
if ($method === 'bearer_send' || $method === 'voice' || $method === 'image') { $sentSuccessfully = sendIntaleqOtp($receiver, $otp, $method ?: 'whatsapp');
$sentSuccessfully = sendNabehOtp($receiver, $otp, $method);
if (!$sentSuccessfully) {
error_log("⚠️ [Jordan OTP Failover] Nabeh JWT method failed. Falling back to Intaleq OTP SMS.");
$sentSuccessfully = sendIntaleqOtp($receiver, $otp, 'sms');
}
} else {
$sentSuccessfully = sendIntaleqOtp($receiver, $otp, $method ?: 'sms');
if (!$sentSuccessfully) {
error_log("⚠️ [Jordan OTP Failover] Intaleq OTP SMS failed. Falling back to Nabeh JWT OTP text.");
$sentSuccessfully = sendNabehOtp($receiver, $otp, 'text');
}
}
break; break;
default: default:

View File

@@ -57,10 +57,11 @@ if ($vendorPath) require_once $vendorPath;
require_once __DIR__ . '/helpers.php'; require_once __DIR__ . '/helpers.php';
// تحديد مسار الـ .env بشكل ديناميكي // تحديد مسار الـ .env بشكل ديناميكي
$siteUser = get_current_user(); $homeDir = realpath(__DIR__ . '/../../../');
$homeDir = "/home/$siteUser"; if (!$homeDir || !is_dir($homeDir)) {
if (!is_dir($homeDir)) { // Fallback if realpath fails
$homeDir = realpath(__DIR__ . '/../../../'); // Fallback $siteUser = get_current_user();
$homeDir = "/home/$siteUser";
} }
$envFile = getenv('ENV_FILE_PATH') ?: ($homeDir . '/.env'); $envFile = getenv('ENV_FILE_PATH') ?: ($homeDir . '/.env');

View File

@@ -113,7 +113,8 @@ class LoginController extends GetxController {
Log.print('AppLink.loginFirstTime: ${AppLink.loginFirstTime}'); Log.print('AppLink.loginFirstTime: ${AppLink.loginFirstTime}');
Log.print('payload: $payload'); Log.print('payload: $payload');
Log.print('response: $response'); Log.print('response code: ${response.statusCode}');
Log.print('response body: ${response.body}');
if (response.statusCode == 200) { if (response.statusCode == 200) {
final decoded = jsonDecode(response.body); final decoded = jsonDecode(response.body);