akshitagupta15june / PetMe

PetMe is an all-in-one platform that allows animals to be adopted, donated to pet lovers, and provides emergency medical care to stray animals in need. Star this repo⭐
https://akshitagupta15june.github.io/PetMe/
MIT License
480 stars 729 forks source link

🪲[Bug]: Phone Number Validation Issue #1754

Open Swapnilden opened 3 months ago

Swapnilden commented 3 months ago

Describe the bug The current implementation of the phone field in the donationSchema is using the Number type and the trim option, which is not valid for numbers. Additionally, this could lead to the mishandling of phone numbers with leading zeros or country codes.

To Reproduce Steps to reproduce the behavior:

1.) Go to the form where donations are submitted. 2.) Enter a phone number with leading zeros or a country code (e.g., +1234567890). 3.) Submit the form. 4.) Observe that the phone number is not stored correctly in the database, potentially leading to loss of leading zeros or errors in saving the document.

Expected behavior Phone numbers should be stored as strings to preserve formatting, including leading zeros and country codes. The trim option should not be used with the phone field.

Screenshots Screenshot (57) Description: This screenshot shows the donation form with the phone number field filled with the number "+1234567890"and the form not showing error for invalid number.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context The phone number should be validated using a proper validation function to ensure it conforms to a valid phone number format. Please assign me this issue under GSSOC'24 to solve this bug.

iamrudhresh commented 3 months ago

I hope you're doing great! As a SSOC contributor, I'm keen on ramping up my involvement for SSOC'24. Could you please assign this issue to me? I'm excited to continue contributing to the project. Thanks a bunch!