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 of Country Code. #1

Closed
thatfreakcoder opened this issue Jun 6, 2021 · 7 comments · Fixed by #4
Closed

No validation of Country Code. #1

thatfreakcoder opened this issue Jun 6, 2021 · 7 comments · Fixed by #4
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@thatfreakcoder
Copy link

Whatsapp Dynamic Link (wa.me) requires a country code in the beginning. Currently, no such validation is preventing it from redirecting.

@iamyajat iamyajat added bug Something isn't working good first issue Good for newcomers labels Aug 4, 2021
@cryptus-neoxys
Copy link
Contributor

Is this up for grabs?

@iamyajat
Copy link
Owner

Sure go ahead @cryptus-neoxys

@cryptus-neoxys
Copy link
Contributor

What would be the best approach for this?

  • IP address lookup to get user's location (probably overkill)
  • GeoLocation API? (poor UX, possibly)

@iamyajat
Copy link
Owner

iamyajat commented Oct 29, 2021

If I'm not wrong, for geolocation, the user will have to grant location access which I think will harm the simplicity of the app.

Maybe this can be used to get the country.

$.get("http://ipinfo.io", function(response) {
    console.log(response.city, response.country);
}, "jsonp");

One more thing, if the user pastes the number directly with a country code then, modify the selected country automatically.

@cryptus-neoxys
Copy link
Contributor

Yeah, similar issues regarding geolocation API requesting permission.

Here's what I could think of as a better alternative: Use geolocation-db's ultimate free service to get the Country data and map that to country Phone code Country Code to Phone Code-JSON
This can then be cached on the user's device for a seamless exp (PWA and whatnot xD)

@iamyajat
Copy link
Owner

Looks good!

@cryptus-neoxys
Copy link
Contributor

Self-hosted alternative:

https://lite.ip2location.com/ip2location-lite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants