twofactor_gateway icon indicating copy to clipboard operation
twofactor_gateway copied to clipboard

Phone number verification - Need to specify country code.

Open nolsen42 opened this issue 5 years ago • 8 comments

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.

nolsen42 avatar Feb 25 '20 02:02 nolsen42

This is hard to implement because we support so many providers. And everyone of them has their own format, unfortunately.

ChristophWurst avatar Feb 25 '20 08:02 ChristophWurst

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-

cdjenkins avatar Jun 01 '20 08:06 cdjenkins

Yet we'd then have to convert it into the format the the specific provider excepts, right?

ChristophWurst avatar Jun 02 '20 07:06 ChristophWurst

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

cdjenkins avatar Jun 02 '20 18:06 cdjenkins

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.

ChristophWurst avatar Jun 03 '20 07:06 ChristophWurst

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.

boppy avatar Jun 03 '20 08:06 boppy

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 😉

j-ed avatar Jun 03 '20 08:06 j-ed

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.

boppy avatar Jun 03 '20 08:06 boppy