Check for invalid chars in letter addresses

This now adds validation for invalid characters on the
LetterAddressForm for one off letters. It also adds a validation failed
message for uploaded letters, precompiled letters sent through the API,
and CSV rows with errors.
This commit is contained in:
Katie Smith
2020-07-28 13:44:14 +01:00
parent 0304edd7a2
commit ba5f7d7c36
5 changed files with 40 additions and 2 deletions

View File

@@ -733,7 +733,17 @@ LETTER_VALIDATION_MESSAGES = {
f'Validation failed because the address must be no more '
f'than {PostalAddress.MAX_LINES} lines long.'
),
}
},
'invalid-char-in-address': {
'title': 'Theres a problem with the address for this letter',
'detail': (
"Address lines must not start with any of the following characters: @ ( ) = [ ] ” \\ / ,"
),
'summary': (
"Validation failed because address lines must not start with any of the "
"following characters: @ ( ) = [ ] ” \\ / ,"
),
},
}