- Change update service name to check that the name/email_from is unique across all services.

- This is done using a new endpoint in the api.
- Removed the AddServiceForm in favor or using the ServiceNameForm
- Removed ServiceApiClient.find_all_service_email_from
This commit is contained in:
Rebecca Law
2017-08-09 16:52:10 +01:00
parent 14be8dc463
commit 9b9c6d75dc
6 changed files with 29 additions and 37 deletions

View File

@@ -212,26 +212,8 @@ class TextNotReceivedForm(Form):
mobile_number = mobile_number()
class AddServiceForm(Form):
def __init__(self, *args, **kwargs):
super(AddServiceForm, self).__init__(*args, **kwargs)
name = StringField(
'Service name',
validators=[
DataRequired(message='Cant be empty')
]
)
class ServiceNameForm(Form):
def __init__(self, names_func, *args, **kwargs):
"""
Keyword arguments:
names_func -- Returns a list of unique service_names already registered
on the system.
"""
self._names_func = names_func
def __init__(self, *args, **kwargs):
super(ServiceNameForm, self).__init__(*args, **kwargs)
name = StringField(
@@ -240,12 +222,6 @@ class ServiceNameForm(Form):
DataRequired(message='Cant be empty')
])
def validate_name(self, a):
from app.utils import email_safe
# make sure the email_from will be unique to all services
if email_safe(a.data) in self._names_func():
raise ValidationError('This service name is already in use')
class ConfirmPasswordForm(Form):
def __init__(self, validate_password_func, *args, **kwargs):