raksha-life / rescuekerala

Website for coordinating rehabilitation of people affected in the Kerala Floods
https://keralarescue.in
MIT License
675 stars 576 forks source link

Add Phone Number Field Validation to avoid incorrect informations #485

Open droidmanspace opened 6 years ago

droidmanspace commented 6 years ago

Subject of the issue

Many people entering a place or other alphabet characters in the field of "Phone". Please add phone number validation to the input field.

Your environment

Steps to reproduce

Apply some condition checks. After only it must be stored in DB.

Expected behavior

Check for input whether it is number and length at least 10.

Actual behaviour

Accept every character as input

Links

https://keralarescue.in/request_details/25138/ https://keralarescue.in/request_details/24203/

Neonkraft commented 6 years ago

484 performs clientside validation of phone numbers. Needs to be tested and approved.

kunalgrover05 commented 6 years ago

https://github.com/stefanfoulis/django-phonenumber-field

vishnuprasadb commented 6 years ago

Guys!

I don't know much about git.! Worked on svn.

So I am just giving a suggestion.

Db level RegexValidator for Phone Number Validations can help.! Hereby giving the phone number validation. Model ` phone_regex = RegexValidator(regex=r'^\s(?:+?(\d{1,3}))?[-. (](\d{3})[-. )](\d{3})[-. ](\d{4})(?: x(\d+))?\s$', message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.")

phone_number = models.CharField(validators=[phone_regex], blank=True, max_length=20)`

ridha commented 6 years ago

I have started working on this issue- Server side validation for phone number

ridha commented 6 years ago

This is fixed in #581