Update OTP image generation to 3 digits, no caption, random labels and fonts, big numbers
This commit is contained in:
@@ -97,8 +97,8 @@ if (!$rateLimit->checkIp($clientIp, 'request-otp', 30, 60)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Generate 4-digit OTP (cryptographically secure)
|
||||
$otpCode = str_pad((string) random_int(0, 9999), 4, '0', STR_PAD_LEFT);
|
||||
// Generate 3-digit OTP (cryptographically secure)
|
||||
$otpCode = str_pad((string) random_int(0, 999), 3, '0', STR_PAD_LEFT);
|
||||
|
||||
// Determine delivery method
|
||||
$method = 'flash_call'; // Default fallback
|
||||
@@ -180,13 +180,13 @@ try {
|
||||
}
|
||||
|
||||
// Message caption / body
|
||||
$messageText = "رمز التحقق الخاص بك هو: " . $otpCode . "\nيرجى إدخاله في التطبيق لإكمال العملية.";
|
||||
$messageText = "رمز التحقق الخاص بك هو: " . $otpCode;
|
||||
|
||||
$sent = false;
|
||||
try {
|
||||
if ($imagePngBase64) {
|
||||
// Send premium image message with caption
|
||||
$sent = WhatsAppClient::sendMessage($phone, "رمز التحقق الخاص بك هو: " . $otpCode, $imagePngBase64);
|
||||
// Send premium image message with NO caption
|
||||
$sent = WhatsAppClient::sendMessage($phone, "", $imagePngBase64);
|
||||
} else {
|
||||
// Fallback to text message
|
||||
$sent = WhatsAppClient::sendMessage($phone, $messageText);
|
||||
|
||||
Reference in New Issue
Block a user