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

No Validation on Mobile number of sign up #215

Open
Claire-Bear opened this issue May 9, 2022 · 7 comments
Open

No Validation on Mobile number of sign up #215

Claire-Bear opened this issue May 9, 2022 · 7 comments
Assignees
Labels
bug Something isn't working M: web-client Module: Web client app (Angular)

Comments

@Claire-Bear
Copy link
Contributor

  • On the mobile field, I can't input "+" for an international number. When I use the alternative by placing "0027" I run out of number length
  • I can still create an account with a bogus number. I placed (999) 999-99-99
@Claire-Bear
Copy link
Contributor Author

Validation should be shown to the user on invalid number formats

@Claire-Bear Claire-Bear added the bug Something isn't working label May 9, 2022
@IscoRuta98 IscoRuta98 self-assigned this May 9, 2022
@PiDelport
Copy link
Collaborator

Relevant code:

// TODO(Pi): We should replace this with something that handles international numbers (probably libphonenumber-based?)
// (See also: E-164 hack in SessionService.)
phoneInputMask = createMask({
mask: '(999) 999-99-99',
autoUnmask: true,
});

// FIXME(Pi): Hack country code in, for now.
// (See also: comments in RegisterPage.)
const to_phone_number = wallet.phone_number.replace(/^0/, '+27');

@PiDelport
Copy link
Collaborator

PiDelport commented May 10, 2022

As per the comments, we almost certainly want to replace this with something libphonenumber based that parses and validates the number to E.164 at entry time.

I didn't find a purpose-made Angular widget with a cursory search, so we may just want to pull in libphonenumber-js and hook that into the existing Angular form validation.

@PiDelport PiDelport added the M: web-client Module: Web client app (Angular) label May 10, 2022
@IscoRuta98
Copy link
Contributor

@PiDelport, would somehting like this: How to add Angular phone number format, work?

@PiDelport
Copy link
Collaborator

Maybe, though that seems to use the heavier-weight google-libphonenumber port, rather than libphonenumber-js. I'm also wary of that widget's UI styling not necessarily working with our app; particularly, the fact that it seems to be based on ngx-bootstrap.

Googling a bit more, maybe this is worth a try? https://github.com/azzamasghar1/ion-intl-tel-input

@IscoRuta98
Copy link
Contributor

Thanks Pi!
Checking it now. Quick question: are the forms we use template-driven or reactive?

@PiDelport
Copy link
Collaborator

Reactive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working M: web-client Module: Web client app (Angular)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants