-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow spaces and special chars in phone number username #6293
Conversation
Sanitize the phone input before sending to backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chiragsalian Added the same for RequestCallPage as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM and works well. Left a minor suggestion for improvement.
src/pages/RequestCallPage.js
Outdated
@@ -106,13 +106,13 @@ class RequestCallPage extends Component { | |||
Growl.error(this.props.translate('requestCallPage.growlMessageNoPersonalPolicy'), 3000); | |||
return; | |||
} | |||
|
|||
const phoneNumber = this.state.phoneNumber.replace(/((?!\n)[()-\s\t])/g, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex in this file has been repeated 4 times. It seems pretty useful as well so how about moving it to a lib file and calling it via a method like getPhoneNumberWithoutSpecialChars
that would do the replace
as well, or moving the regex to CONST. This way we can DRY up the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you for the changes.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by @chiragsalian in version: 1.1.15-18 🚀
|
🚀 Deployed to production by @roryabraham in version: 1.1.16-10 🚀
|
Details
#6227 (comment)
Fixed Issues
$ #6227
Tests | QA Steps
-
,(
,)
or spaces (e.g. +1 (222) 222 2222)Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android