twofactor_gateway
twofactor_gateway copied to clipboard
Phone number verification - Need to specify country code.
Certain SMS services (at least with sms77.io) will send SMS messages to the wrong person if the user doesn't specify their country code, which is a common thing to omit when entering their number. It'd be a good idea if the app specifically tells you to enter a country code, or a dropdown box with all the country codes of the world.
This is hard to implement because we support so many providers. And everyone of them has their own format, unfortunately.
One option is to have all number in E.164 format (which specifies the country code): https://developers.omnisend.com/guides/e164-phone-number-formatting https://support.plivo.com/support/solutions/articles/17000042303-do-i-need-to-add-country-code-while-dialling-out-
Yet we'd then have to convert it into the format the the specific provider excepts, right?
Option #1) Only accept E.164 or few acceptable formats. No need to accept 10 number formats. Option #2) Have each app handle phone number formats specific to itself
In terms of UI complexity I'd favor option 1 because we can focus on one format. Then each of the providers can convert the number into any other format if necessary.
In terms of UI complexity I'd favor option 1 because we can focus on one format. Then each of the providers can convert the number into any other format if necessary.
Absolutely! And E.164 is commonly used and known (not the name, but the format ;-))... Question is validation. I'm in for ^\+?[1-9]\d{1,14}$
(src) as storage regex and ^\+?[1-9][\d\s]{1,20}$
for User Input.
If you create any input check you should have in mind that countries exist, like e.g. Liechtenstein, where no area codes exist. A number is formatted like this: +423 99887766 😉
If you create any input check you should have in mind that countries exist, like e.g. Liechtenstein, where no area codes exist. A number is formatted like this: +423 99887766 😉
Yes, that's why I don't like any "advanced" check. The Regex pasted just ensures that
- Number starts with an optional
+
(we might/should make this required to avoid problems) - First digit is not 0
- 1 to 14 digits follow
All this, for sure, tbd.