fix(security): fix login AND logic to OR, add signup input validation, separate OTP rate limit keys
This commit is contained in:
@@ -12,6 +12,24 @@ $gender = filterRequest("gender");
|
||||
$birthdate = filterRequest("birthdate");
|
||||
$site = filterRequest("site");
|
||||
|
||||
// --- Input Validation ---
|
||||
if (empty($phone) || strlen(preg_replace('/\D+/', '', $phone)) < 8) {
|
||||
jsonError("Valid phone number is required.");
|
||||
exit;
|
||||
}
|
||||
if (!empty($email) && !filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
jsonError("Valid email address is required.");
|
||||
exit;
|
||||
}
|
||||
if (empty($password) || strlen($password) < 6) {
|
||||
jsonError("Password must be at least 6 characters.");
|
||||
exit;
|
||||
}
|
||||
if (empty($first_name) || empty($last_name)) {
|
||||
jsonError("First name and last name are required.");
|
||||
exit;
|
||||
}
|
||||
|
||||
// تشفير البيانات الحساسة
|
||||
$phone = $encryptionHelper->encryptData($phone);
|
||||
$email = $encryptionHelper->encryptData($email);
|
||||
|
||||
Reference in New Issue
Block a user