mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Store phone number as the user entered it
It’s confusing to the user to have their phone number played back to them in a format that they didn’t enter it. We’ve seen multiple times that people enter 0781… and then don’t recognise their own phone number when it’s played back as +44781… The API can handle phone numbers in any format as of https://github.com/alphagov/notifications-api/pull/134 So there is no need to reformat the user’s phone number before storing it now.
This commit is contained in:
@@ -37,19 +37,10 @@ class UKMobileNumber(TelField):
|
||||
|
||||
def pre_validate(self, form):
|
||||
try:
|
||||
self.data = validate_phone_number(self.data)
|
||||
validate_phone_number(self.data)
|
||||
except InvalidPhoneError as e:
|
||||
raise ValidationError(e.message)
|
||||
|
||||
def post_validate(self, form, validation_stopped):
|
||||
|
||||
if len(self.data) != 9:
|
||||
return
|
||||
# TODO implement in the render field method.
|
||||
# API's require no spaces in the number
|
||||
# self.data = '+44 7{} {} {}'.format(*re.findall('...', self.data))
|
||||
self.data = format_phone_number(self.data)
|
||||
|
||||
|
||||
def mobile_number():
|
||||
return UKMobileNumber('Mobile phone number',
|
||||
|
||||
Reference in New Issue
Block a user