mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-27 11:19:21 -04:00
Don’t allow adding unknown domains to branding lookup
We should make sure we’re not putting typos in the branding list. We can validate what gets entered here against our known list of public-sector domains.
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 Spreadsheet, is_gov_user
|
||||
from app.utils import AgreementInfo, Spreadsheet, is_gov_user
|
||||
|
||||
|
||||
class Blacklist:
|
||||
@@ -102,3 +102,12 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user