Merge branch 'bugfix/yasi_fixed_login_phone' into 'develop'

This commit is contained in:
AmirHossein Mahmoodi
2023-12-20 11:26:16 +00:00
2 changed files with 21 additions and 3 deletions

View File

@@ -27,7 +27,12 @@ const SendUserDataComponent = ({
phone_number: PhoneNumber,
};
const validationSchema = Yup.object().shape({
phone_number: Yup.string().required(t("LoginPage.error_message_phone_number")),
phone_number: Yup.mixed()
.test("max", `${t("LoginPage.phone_number_max")}`, (value) => {
const stringValue = String(value);
return stringValue.length === 11
})
.required(t("LoginPage.error_message_phone_number")),
});
const handleSubmit = (values, props) => {
@@ -76,7 +81,19 @@ const SendUserDataComponent = ({
placeholder={t(
"LoginPage.text_field_enter_your_phone_number"
)}
type={"text"}
type={"tel"}
onChange={(event) => {
const inputValue = event.target.value;
if (isNaN(Number(inputValue))) {
return;
}
props.handleChange({
target: {
name: "phone_number",
value: inputValue,
},
});
}}
error={
!!(props.touched.phone_number && props.errors.phone_number)
}