mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-03 23:51:22 -04:00
Remove domains from branding forms
We’re deprecating storing the domain as text on a branding in favour of a database relationship between branding and organisation. We need to do this now in order to remove the validation on these fields (which depends on the data in `domains.yml`)
This commit is contained in:
@@ -11,7 +11,7 @@ from wtforms.validators import Email
|
||||
|
||||
from app import formatted_list
|
||||
from app.main._blacklisted_passwords import blacklisted_passwords
|
||||
from app.utils import AgreementInfo, Spreadsheet, is_gov_user
|
||||
from app.utils import Spreadsheet, is_gov_user
|
||||
|
||||
|
||||
class Blacklist:
|
||||
@@ -111,34 +111,3 @@ class DoesNotStartWithDoubleZero:
|
||||
def __call__(self, form, field):
|
||||
if field.data and field.data.startswith("00"):
|
||||
raise ValidationError(self.message)
|
||||
|
||||
|
||||
class KnownGovernmentDomain:
|
||||
|
||||
message = 'Not a known government domain (you might need to update domains.yml)'
|
||||
|
||||
def __call__(self, form, field):
|
||||
if field.data and AgreementInfo(field.data).owner is None:
|
||||
raise ValidationError(self.message)
|
||||
|
||||
|
||||
class CanonicalGovernmentDomain:
|
||||
|
||||
message = 'Not {} domain (use {} if appropriate)'
|
||||
|
||||
def __call__(self, form, field):
|
||||
|
||||
if not field.data:
|
||||
return
|
||||
|
||||
domain = AgreementInfo(field.data)
|
||||
|
||||
if not domain.is_canonical:
|
||||
raise ValidationError(
|
||||
self.message.format('a canonical', domain.canonical_domain)
|
||||
)
|
||||
|
||||
if field.data != domain.canonical_domain:
|
||||
raise ValidationError(
|
||||
self.message.format('an organisation-level', domain.canonical_domain)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user