refactor: enhance phone number validation and input handling in Field and LogInPage components

This commit is contained in:
hamed
2025-11-17 15:09:25 +03:30
parent 5a58c13a4e
commit 2777db3b8c
4 changed files with 51 additions and 8 deletions
+6
View File
@@ -127,6 +127,12 @@ export function validatePhoneNumber(input) {
return { valid: false, text: "شماره موبایل نمی‌تواند خالی باشد." };
}
// چک کردن اینکه فقط اعداد انگلیسی باشد
const hasNonEnglishDigits = /[^0-9]/.test(input);
if (hasNonEnglishDigits) {
return { valid: false, text: "فقط از اعداد انگلیسی استفاده کنید." };
}
if (input.length !== 11) {
return { valid: false, text: "شماره موبایل باید دقیقا 11 رقم باشد." };
}