mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 21:49:37 -04:00
Allow straight single quote in sms sender names
This is so we can allow the sender name 'UC' for DWP. Note, this is specifically only straight single quotes and not curly quotes or double quotes. Curly quotes are not supported in the GSM character set (https://en.wikipedia.org/wiki/GSM_03.38). There is currently no defined user ask to support double quotes in sms sender names. I have tested this by sending a message through both Firetext and MMG to make sure they both support the single quote character in SMS sender names. DWP also have had no particular issues using the SMS sender name with their existing system in the past either.
This commit is contained in:
@@ -45,7 +45,7 @@ from app.main.validators import (
|
||||
CommonlyUsedPassword,
|
||||
CsvFileValidator,
|
||||
DoesNotStartWithDoubleZero,
|
||||
LettersNumbersFullStopsAndUnderscoresOnly,
|
||||
LettersNumbersSingleQuotesFullStopsAndUnderscoresOnly,
|
||||
MustContainAlphanumericCharacters,
|
||||
NoCommasInPlaceHolders,
|
||||
NoEmbeddedImagesInSVG,
|
||||
@@ -1734,7 +1734,7 @@ class ServiceSmsSenderForm(StripWhitespaceForm):
|
||||
DataRequired(message="Cannot be empty"),
|
||||
Length(max=11, message="Enter 11 characters or fewer"),
|
||||
Length(min=3, message="Enter 3 characters or more"),
|
||||
LettersNumbersFullStopsAndUnderscoresOnly(),
|
||||
LettersNumbersSingleQuotesFullStopsAndUnderscoresOnly(),
|
||||
DoesNotStartWithDoubleZero(),
|
||||
]
|
||||
)
|
||||
|
||||
@@ -144,9 +144,9 @@ class BroadcastLength:
|
||||
)
|
||||
|
||||
|
||||
class LettersNumbersFullStopsAndUnderscoresOnly:
|
||||
class LettersNumbersSingleQuotesFullStopsAndUnderscoresOnly:
|
||||
|
||||
regex = re.compile(r'^[a-zA-Z0-9\s\._]+$')
|
||||
regex = re.compile(r"^[a-zA-Z0-9\s\._']+$")
|
||||
|
||||
def __init__(self, message='Use letters and numbers only'):
|
||||
self.message = message
|
||||
|
||||
@@ -199,6 +199,7 @@ def test_if_string_contains_alphanumeric_characters_does_not_raise(string):
|
||||
('00111222333', True, 'Cannot start with 00'),
|
||||
('UK_GOV', False, None), # Underscores are allowed
|
||||
('UK.GOV', False, None), # Full stops are allowed
|
||||
("'UC'", False, None), # Straight single quotes are allowed
|
||||
]
|
||||
)
|
||||
def test_sms_sender_form_validation(
|
||||
|
||||
Reference in New Issue
Block a user