Let whitelist and user have int. phone numbers

On the frontend, we’re letting users register with international phone
numbers. So we shouldn’t block users from doing this on the API side.

Same thing for the whitelist, where we’re also allowing international
phone numbers now.
This commit is contained in:
Chris Hill-Scott
2017-08-30 10:55:18 +01:00
parent caea65165c
commit 26f50af6e9
4 changed files with 12 additions and 6 deletions

View File

@@ -318,7 +318,7 @@ class ServiceWhitelist(db.Model):
try:
if recipient_type == MOBILE_TYPE:
validate_phone_number(recipient)
validate_phone_number(recipient, international=True)
instance.recipient = recipient
elif recipient_type == EMAIL_TYPE:
validate_email_address(recipient)

View File

@@ -130,7 +130,7 @@ class UserUpdateAttributeSchema(BaseSchema):
@validates('mobile_number')
def validate_mobile_number(self, value):
try:
validate_phone_number(value)
validate_phone_number(value, international=True)
except InvalidPhoneError as error:
raise ValidationError('Invalid phone number: {}'.format(error))