mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-23 09:29:14 -04:00
Validate non canonical domains
At the moment we transform what the user gives us, so if someone enters `digital.cabinet-office.gov.uk` it will automagically be saved as `cabinet-office.gov.uk`. This happens without the user knowing, and might have unintended consequences. So let’s tell them what the problem is, and let them decide what to do about it (which might be accepting the canonical domain, or adding a new organisation to domains.yml first).
This commit is contained in:
@@ -33,6 +33,7 @@ from wtforms.validators import URL, DataRequired, Length, Optional, Regexp
|
||||
|
||||
from app.main.validators import (
|
||||
Blacklist,
|
||||
CanonicalGovernmentDomain,
|
||||
CsvFileValidator,
|
||||
DoesNotStartWithDoubleZero,
|
||||
KnownGovernmentDomain,
|
||||
@@ -721,7 +722,10 @@ class ServicePreviewBranding(StripWhitespaceForm):
|
||||
|
||||
|
||||
class GovernmentDomainField(StringField):
|
||||
validators = [KnownGovernmentDomain()]
|
||||
validators = [
|
||||
KnownGovernmentDomain(),
|
||||
CanonicalGovernmentDomain(),
|
||||
]
|
||||
|
||||
def post_validate(self, form, validation_stopped):
|
||||
if self.data and not self.errors:
|
||||
|
||||
Reference in New Issue
Block a user