GeekZoneHQ / web

Software to power the Geek.Zone website and apps
http://geek.zone/web
GNU General Public License v3.0
19 stars 29 forks source link

Telephone number check #617

Open jamesgeddes opened 2 years ago

jamesgeddes commented 2 years ago

What's your idea?

Check if provided telephone number is in fake range

https://www.ofcom.org.uk/phones-telecoms-and-internet/information-for-industry/numbering/numbers-for-drama

Could show the user a funny error message, perhaps something like,

OK Doctor, that phone number might have worked on Gallifrey but it does not work on this Earth. Please can you tell us your real, Earth telephone number?

User Story

As a Data Controller, I want to ensure that GZ holds accurate and up to date information on each member so that we can comply with GDPR and contact the appropriate individuals in an emergency.

Impact

Low

Urgency

Now

Code of Conduct

SamWinterhalder commented 2 years ago

Does the include/should this extend to verifying the phone number?

jamesgeddes commented 2 years ago

@SamWinterhalder That is covered in #50, so this is just intended as a guard clause to check for numbers that cannot be valid. If it is on the unassigned list, there is no point in doing any further checking.

jamesgeddes commented 2 years ago

I have compiled the full list of all unassigned telephone numbers. Was an interesting little morning coding exercise :smile:

Source code ```python3 start_end = [ ["01134960000", "01134960999"], ["01144960000", "01144960999"], ["01154960000", "01154960999"], ["01164960000", "01164960999"], ["01174960000", "01174960999"], ["01184960000", "01184960999"], ["01214960000", "01214960999"], ["01314960000", "01314960999"], ["01414960000", "01414960999"], ["01514960000", "01514960999"], ["01614960000", "01614960999"], ["02079460000", "02079460999"], ["01914980000", "01914980999"], ["02896496000", "02896496999"], ["02920180000", "02920180999"], ["01632960000", "01632960999"], ["07700900000", "07700900999"], ["08081570000", "08081570999"], ["09098790000", "09098790999"], ["03069990000", "03069990999"] ] telephone_numbers = [] for telephone_range in start_end: this_telephone = int(telephone_range[0].lstrip("0")) end_telephone = int(telephone_range[1].lstrip("0")) while this_telephone <= end_telephone: telephone_numbers.append(f"0{this_telephone}") this_telephone += 1 print(telephone_numbers) ```

I would suggest referencing this list, rather than computing it every time.