-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2891 from cisagov/dk/2777-update-messaging
#2777: updated error messages for zip codes and email addresses
- Loading branch information
Showing
9 changed files
with
29 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,10 @@ class DomainAddUserForm(forms.Form): | |
email = forms.EmailField( | ||
label="Email", | ||
max_length=None, | ||
error_messages={"invalid": ("Enter your email address in the required format, like [email protected].")}, | ||
error_messages={ | ||
"invalid": ("Enter an email address in the required format, like [email protected]."), | ||
"required": ("Enter an email address in the required format, like [email protected]."), | ||
}, | ||
validators=[ | ||
MaxLengthValidator( | ||
320, | ||
|
@@ -285,7 +288,7 @@ def __init__(self, *args, **kwargs): | |
"required": "Enter your title or role in your organization (e.g., Chief Information Officer)" | ||
} | ||
self.fields["email"].error_messages = { | ||
"required": "Enter your email address in the required format, like [email protected]." | ||
"required": "Enter an email address in the required format, like [email protected]." | ||
} | ||
self.fields["phone"].error_messages["required"] = "Enter your phone number." | ||
self.domainInfo = None | ||
|
@@ -342,7 +345,7 @@ def __init__(self, *args, **kwargs): | |
"required": "Enter your title or role in your organization (e.g., Chief Information Officer)" | ||
} | ||
self.fields["email"].error_messages = { | ||
"required": "Enter your email address in the required format, like [email protected]." | ||
"required": "Enter an email address in the required format, like [email protected]." | ||
} | ||
self.fields["phone"].error_messages["required"] = "Enter your phone number." | ||
self.domainInfo = None | ||
|
@@ -458,9 +461,12 @@ class DomainOrgNameAddressForm(forms.ModelForm): | |
validators=[ | ||
RegexValidator( | ||
"^[0-9]{5}(?:-[0-9]{4})?$|^$", | ||
message="Enter a zip code in the required format, like 12345 or 12345-6789.", | ||
message="Enter a 5-digit or 9-digit zip code, like 12345 or 12345-6789.", | ||
) | ||
], | ||
error_messages={ | ||
"required": "Enter a 5-digit or 9-digit zip code, like 12345 or 12345-6789.", | ||
}, | ||
) | ||
|
||
class Meta: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,10 +144,10 @@ class OrganizationContactForm(RegistrarForm): | |
validators=[ | ||
RegexValidator( | ||
"^[0-9]{5}(?:-[0-9]{4})?$|^$", | ||
message="Enter a zip code in the form of 12345 or 12345-6789.", | ||
message="Enter a 5-digit or 9-digit zip code, like 12345 or 12345-6789.", | ||
) | ||
], | ||
error_messages={"required": ("Enter a zip code in the form of 12345 or 12345-6789.")}, | ||
error_messages={"required": ("Enter a 5-digit or 9-digit zip code, like 12345 or 12345-6789.")}, | ||
) | ||
urbanization = forms.CharField( | ||
required=False, | ||
|
@@ -233,7 +233,10 @@ def from_database(cls, obj): | |
email = forms.EmailField( | ||
label="Email", | ||
max_length=None, | ||
error_messages={"invalid": ("Enter an email address in the required format, like [email protected].")}, | ||
error_messages={ | ||
"invalid": ("Enter an email address in the required format, like [email protected]."), | ||
"required": ("Enter an email address in the required format, like [email protected]."), | ||
}, | ||
validators=[ | ||
MaxLengthValidator( | ||
320, | ||
|
@@ -610,7 +613,8 @@ class CisaRepresentativeForm(BaseDeletableRegistrarForm): | |
max_length=None, | ||
required=False, | ||
error_messages={ | ||
"invalid": ("Enter your representative’s email address in the required format, like [email protected]."), | ||
"invalid": ("Enter an email address in the required format, like [email protected]."), | ||
"required": ("Enter an email address in the required format, like [email protected]."), | ||
}, | ||
validators=[ | ||
MaxLengthValidator( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ def __init__(self, *args, **kwargs): | |
"required": "Enter your title or role in your organization (e.g., Chief Information Officer)" | ||
} | ||
self.fields["email"].error_messages = { | ||
"required": "Enter your email address in the required format, like [email protected]." | ||
"required": "Enter an email address in the required format, like [email protected]." | ||
} | ||
self.fields["phone"].error_messages["required"] = "Enter your phone number." | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,7 +240,7 @@ class SecurityEmailError(Exception): | |
""" | ||
|
||
_error_mapping = { | ||
SecurityEmailErrorCodes.BAD_DATA: ("Enter an email address in the required format, " "like [email protected]."), | ||
SecurityEmailErrorCodes.BAD_DATA: ("Enter an email address in the required format, like [email protected]."), | ||
} | ||
|
||
def __init__(self, *args, code=None, **kwargs): | ||
|