Deploy: 2026-05-23 18:23:34
This commit is contained in:
@@ -97,8 +97,8 @@ if (!$rateLimit->checkIp($clientIp, 'request-otp', 30, 60)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate 3-digit OTP (cryptographically secure)
|
// Generate 3-digit OTP (cryptographically secure, always between 100 and 999)
|
||||||
$otpCode = str_pad((string) random_int(0, 999), 3, '0', STR_PAD_LEFT);
|
$otpCode = (string) random_int(100, 999);
|
||||||
|
|
||||||
// Determine delivery method
|
// Determine delivery method
|
||||||
$method = 'flash_call'; // Default fallback
|
$method = 'flash_call'; // Default fallback
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ if (!preg_match('/^\+[1-9]\d{6,14}$/', $phone)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate OTP format (4 digits)
|
// Validate OTP format (3 or 4 digits)
|
||||||
if (!preg_match('/^\d{4}$/', $otp)) {
|
if (!preg_match('/^\d{3,4}$/', $otp)) {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
echo json_encode(['success' => false, 'message' => 'invalid_otp_format']);
|
echo json_encode(['success' => false, 'message' => 'invalid_otp_format']);
|
||||||
RequestLogger::log('verify-otp', 'POST', $input, 400, 'invalid_otp_format');
|
RequestLogger::log('verify-otp', 'POST', $input, 400, 'invalid_otp_format');
|
||||||
|
|||||||
Reference in New Issue
Block a user