mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 13:39:41 -04:00
Add form validation for max service and org name
There was a recent error in the logs because a service tried to change its name to one exceeding 255 characters (which is a limit on the database field). We can easily catch these errors on the form, so that the user doesn't see an error page.
This commit is contained in:
@@ -1106,7 +1106,8 @@ class RenameServiceForm(StripWhitespaceForm):
|
||||
u'Service name',
|
||||
validators=[
|
||||
DataRequired(message='Cannot be empty'),
|
||||
MustContainAlphanumericCharacters()
|
||||
MustContainAlphanumericCharacters(),
|
||||
Length(max=255, message='Service name must be 255 characters or fewer')
|
||||
])
|
||||
|
||||
|
||||
@@ -1115,7 +1116,8 @@ class RenameOrganisationForm(StripWhitespaceForm):
|
||||
u'Organisation name',
|
||||
validators=[
|
||||
DataRequired(message='Cannot be empty'),
|
||||
MustContainAlphanumericCharacters()
|
||||
MustContainAlphanumericCharacters(),
|
||||
Length(max=255, message='Organisation name must be 255 characters or fewer')
|
||||
])
|
||||
|
||||
|
||||
@@ -1223,7 +1225,8 @@ class CreateServiceForm(StripWhitespaceForm):
|
||||
"What’s your service called?",
|
||||
validators=[
|
||||
DataRequired(message='Cannot be empty'),
|
||||
MustContainAlphanumericCharacters()
|
||||
MustContainAlphanumericCharacters(),
|
||||
Length(max=255, message='Service name must be 255 characters or fewer')
|
||||
])
|
||||
organisation_type = OrganisationTypeField('Who runs this service?')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user