mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-29 18:18:32 -04:00
Validate name field on ServiceUpdateEmailBranding form
This introduces a validator to validate that the name field is not empty on the ServiceUpdateEmailBranding form, but only if the form details are being submitted. If a file is being uploaded, the name is allowed to be empty.
This commit is contained in:
@@ -848,6 +848,11 @@ class ServiceUpdateEmailBranding(StripWhitespaceForm):
|
||||
]
|
||||
)
|
||||
|
||||
def validate_name(form, name):
|
||||
op = request.form.get('operation')
|
||||
if op == 'email-branding-details' and not form.name.data:
|
||||
raise ValidationError('This field is required')
|
||||
|
||||
|
||||
class PDFUploadForm(StripWhitespaceForm):
|
||||
file = FileField_wtf(
|
||||
|
||||
Reference in New Issue
Block a user