mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 01:04:00 -04:00
Merge pull request #407 from alphagov/fix_uppercase_white_list_bug
Fix issue with uppercase in the domain name.
This commit is contained in:
@@ -36,5 +36,5 @@ class ValidEmailDomainRegex(object):
|
|||||||
"https://docs.google.com/forms/d/1AL8U-xJX_HAFEiQiJszGQw0PcEaEUnYATSntEghNDGo/viewform")
|
"https://docs.google.com/forms/d/1AL8U-xJX_HAFEiQiJszGQw0PcEaEUnYATSntEghNDGo/viewform")
|
||||||
valid_domains = current_app.config.get('EMAIL_DOMAIN_REGEXES', [])
|
valid_domains = current_app.config.get('EMAIL_DOMAIN_REGEXES', [])
|
||||||
email_regex = "[^\@^\s]+@([^@^\\.^\\s]+\.)*({})$".format("|".join(valid_domains))
|
email_regex = "[^\@^\s]+@([^@^\\.^\\s]+\.)*({})$".format("|".join(valid_domains))
|
||||||
if not re.match(email_regex, field.data):
|
if not re.match(email_regex, field.data.lower()):
|
||||||
raise ValidationError(message)
|
raise ValidationError(message)
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ def _gen_mock_field(x):
|
|||||||
|
|
||||||
@pytest.mark.parametrize("email", [
|
@pytest.mark.parametrize("email", [
|
||||||
'test@gov.uk',
|
'test@gov.uk',
|
||||||
|
'test@GOV.UK',
|
||||||
|
'test@gov.uK',
|
||||||
'test@test.test.gov.uk',
|
'test@test.test.gov.uk',
|
||||||
'test@test.gov.uk',
|
'test@test.gov.uk',
|
||||||
'test@mod.uk',
|
'test@mod.uk',
|
||||||
@@ -71,7 +73,8 @@ def _gen_mock_field(x):
|
|||||||
'test@nhs.net',
|
'test@nhs.net',
|
||||||
'test@gov.nhs.net',
|
'test@gov.nhs.net',
|
||||||
'test@police.uk',
|
'test@police.uk',
|
||||||
'test@gov.police.uk'
|
'test@gov.police.uk',
|
||||||
|
'test@GOV.PoliCe.uk',
|
||||||
])
|
])
|
||||||
def test_valid_list_of_white_list_email_domains(app_, email):
|
def test_valid_list_of_white_list_email_domains(app_, email):
|
||||||
with app_.test_request_context():
|
with app_.test_request_context():
|
||||||
|
|||||||
Reference in New Issue
Block a user