Skip to content
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

Phone validator does not allow a "+" prefix #16

Open
willjleongdv opened this issue Jan 25, 2018 · 1 comment
Open

Phone validator does not allow a "+" prefix #16

willjleongdv opened this issue Jan 25, 2018 · 1 comment

Comments

@willjleongdv
Copy link

willjleongdv commented Jan 25, 2018

With the Twillio SMS challenge, foreign numbers (only non-US numbers with the + prefix) do not work with twillio without a "+" prefix. The duex validator throws an validation error if the "+" is in the phone number string. Specifically, I was unable to enable mfa for a uk/french number what twillio required +44 or +33 for the sms/request register endpoint.

Consider changing phone_number_validator to support international numbers. Using a library like https://github.com/daviddrysdale/python-phonenumbers my be a more holistic approach.

validators.py Regex can look like this
phone_number_validator = RegexValidator( regex=r"^(\+?\d{7,15})$", message=strings.INVALID_PHONE_NUMBER_ERROR )

@jonstep
Copy link

jonstep commented Jan 25, 2018

Hi @willjleongdv!

Funnily enough I had the same issue today and came up with same solution. I have created a PR with the fix, in the meantime feel free to use my forked version (https://github.com/jonstep/deux)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants