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

Widget needed for email or phone number #339

Open
jace opened this issue Jan 21, 2021 · 0 comments
Open

Widget needed for email or phone number #339

jace opened this issue Jan 21, 2021 · 0 comments
Assignees

Comments

@jace
Copy link
Member

jace commented Jan 21, 2021

Funnel needs a mixed-use widget in two places:

  1. The login form currently accepts "username or email"
  2. The registration form currently accepts an email address

There is a pending requirement to add support for a phone number (in funnel/issues#693), turning these use cases into:

  1. Login: Username or email address or phone number
  2. Register: Email address or phone number

A backend validator can detect the content type and process accordingly. The front-end however needs to give the user a hint of what is going on, and the UI pattern adopted by Decathlon may be our best inspiration.

The front-end widget must switch widget type and appearance based on which of the following regex patterns match:

  1. International phone: \+[0-9. -]+ (allows period, space and dash in input, to be stripped later)
  2. Local phone: [0-9. -]+
  3. Email: .*@.*
  4. Default: input type="text" (assume username)

The difference between international phone and local phone is that a guessed country code must appear when in local phone mode, as the submitted field will need to include the +country prefix. The code can be guessed from IP address location or browser timezone, using libphonenumber. (The server can send this pre-filled in the form to avoid adding a new JS library.)

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

3 participants