Skip to content

Commit

Permalink
fix: properly check for valid number
Browse files Browse the repository at this point in the history
Signed-off-by: Anjana Mendiratta <[email protected]>
  • Loading branch information
GItGudRatio committed Jul 18, 2023
1 parent 0432a30 commit b80958f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/settings/Profile/Contacts/NewContactMethodPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const getPhoneLogin = (phoneOrEmail) => {
const validateNumber = (values) => {
const parsedPhoneNumber = parsePhoneNumber(values);

if (parsedPhoneNumber.possible) {
if (parsedPhoneNumber.possible && Str.isValidPhone(values.slice(0))) {
return parsedPhoneNumber.number.e164 + CONST.SMS.DOMAIN;
}

Expand Down Expand Up @@ -94,7 +94,7 @@ function NewContactMethodPage(props) {
ErrorUtils.addErrorMessage(errors, 'phoneOrEmail', 'contacts.genericFailureMessages.contactMethodRequired');
}

if (!_.isEmpty(values.phoneOrEmail) && !((parsePhoneNumber(phoneLogin).possible && Str.isValidPhone(phoneLogin.slice(0))) || Str.isValidEmail(values.phoneOrEmail))) {
if (!_.isEmpty(values.phoneOrEmail) && !(validateIfnumber || Str.isValidEmail(values.phoneOrEmail))) {
ErrorUtils.addErrorMessage(errors, 'phoneOrEmail', 'contacts.genericFailureMessages.invalidContactMethod');
}

Expand Down

0 comments on commit b80958f

Please sign in to comment.