You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$500] Invalid phone number is accepted when starting a new chat #32242
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
Please re-state the problem that we are trying to solve in this issue.
Invalid phone number is accepted when starting a new chat
What is the root cause of that problem?
Now, our project is using parsePhoneNumber function of awesome-phonenumber package which has some bug.
It sometimes accept invalid phone number as valid so we should add custom checking code after validation.
When parse number, this function convert input string to e164 type in module.
Because of it, some invalid input string is changed to valid string.
This occurs about only invalid string.
You can know about it If you check following photo.
What changes do you think we should make in order to solve the problem?
If invalid string is entered, its input and e164 string is different, while valid string is entered, its input and e164 string is same.
so we can just add comparison code between input and e164 strings.
I checked these results in native app and chrome. As a result it works well now.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
changed the title [-] Invalid phone number is accepted when starting a new chat[/-][+][$500] Invalid phone number is accepted when starting a new chat[/+]on Nov 30, 2023
Please re-state the problem that we are trying to solve in this issue.
Invalid phone number is accepted when starting a new chat
What is the root cause of that problem?
the country code 1 is removed from the number +112345678900 resulting in +12345678900, might occur due to how the country code addition and formatting are handled in the context of the awesome-phonenumber library.
What changes do you think we should make in order to solve the problem?
Please re-state the problem that we are trying to solve in this issue.
An invalid phone number is accepted when starting a new chat.
What is the root cause of that problem?
The core issue at hand stems from the functionality of the parsePhoneNumber method. When the input +112345678900 is processed by this method, it produces the following result:
While the number.input value appears to be invalid due to the presence of an additional '1', the e164 value eliminates this extraneous digit, resulting in the representation of a valid phone number.
What changes do you think we should make in order to solve the problem?
We can improve the existing code by adding an extra check, comparing the e164 and input values for equality.
📣 @erichasinternet! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
Activity
melvin-bot commentedon Nov 30, 2023
Triggered auto assignment to @NicMendonca (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Nov 30, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)crypto1014 commentedon Nov 30, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Invalid phone number is accepted when starting a new chat
What is the root cause of that problem?
Now, our project is using parsePhoneNumber function of
awesome-phonenumberpackage which has some bug.It sometimes accept invalid phone number as valid so we should add custom checking code after validation.
When parse number, this function convert input string to e164 type in module.
const parsedPhoneNumber = parsePhoneNumber(LoginUtils.appendCountryCode(Str.removeSMSDomain(searchInputValue)));Because of it, some invalid input string is changed to valid string.

This occurs about only invalid string.
You can know about it If you check following photo.
What changes do you think we should make in order to solve the problem?
If invalid string is entered, its input and e164 string is different, while valid string is entered, its input and e164 string is same.
so we can just add comparison code between input and e164 strings.
In OptionsListUtils.js 1132 Line
From
To
This is result.

I checked these results in native app and chrome. As a result it works well now.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
[-] Invalid phone number is accepted when starting a new chat[/-][+][$500] Invalid phone number is accepted when starting a new chat[/+]melvin-bot commentedon Nov 30, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01b8deeaa5835d9589
melvin-bot commentedon Nov 30, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ntdiary (
External)kaushiktd commentedon Dec 1, 2023
Please re-state the problem that we are trying to solve in this issue.
Invalid phone number is accepted when starting a new chat
What is the root cause of that problem?
the country code 1 is removed from the number +112345678900 resulting in +12345678900, might occur due to how the country code addition and formatting are handled in the context of the awesome-phonenumber library.
What changes do you think we should make in order to solve the problem?
https://github.com/Expensify/App/blob/main/src/libs/OptionsListUtils.js#L1623
in
this will set the error if the input and e164 value is not same which solves the problem of not showing error message
also to hide the popup we need to wrap in condition,
https://github.com/Expensify/App/blob/main/src/libs/OptionsListUtils.js#L1330
Video:
https://drive.google.com/file/d/1FcEDYvB6-CxJ7WZsStJkBJ9FKr0zIFTz/view?usp=drive_link
situchan commentedon Dec 5, 2023
situchan commentedon Dec 5, 2023
akinwale commentedon Dec 5, 2023
Taking over as C+ here.
The existing proposals do not adequately address the issue. Looking for more proposals.
erichasinternet commentedon Dec 5, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
An invalid phone number is accepted when starting a new chat.
What is the root cause of that problem?
The core issue at hand stems from the functionality of the
parsePhoneNumbermethod. When the input+112345678900is processed by this method, it produces the following result:While the
number.inputvalue appears to be invalid due to the presence of an additional '1', thee164value eliminates this extraneous digit, resulting in the representation of a valid phone number.What changes do you think we should make in order to solve the problem?
We can improve the existing code by adding an extra check, comparing the e164 and input values for equality.
We'll also need to add the
e164andinputcomparison here to prevent both an account and an error message from being returned simultaneously.Bug-fix demo:
Screenshot of expected result:

Video showing expected behavior:
Screen.Recording.2023-12-05.at.1.11.20.PM.mov
melvin-bot commentedon Dec 5, 2023
📣 @erichasinternet! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
erichasinternet commentedon Dec 5, 2023
Contributor details
Your Expensify account email: elawson545@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01bb13350fc87c5468
melvin-bot commentedon Dec 5, 2023
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
FitseTLT commentedon Dec 5, 2023
This will be fixed by #31726
melvin-bot commentedon Dec 5, 2023
@ntdiary, @NicMendonca Huh... This is 4 days overdue. Who can take care of this?
MariaHCD commentedon Dec 6, 2023
Seems like this one might be a dupe of #28492
Thoughts, @akinwale?
akinwale commentedon Dec 6, 2023
Yeah, looks like it. We can close this one.