refactor: enhance phone number validation and input handling in Field and LogInPage components
This commit is contained in:
@@ -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 رقم باشد." };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user