mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 08:16:51 -04:00
Merge pull request #490 from alphagov/contact-link-signup
Updated the contact us link for non gov.uk domains trying to register.
This commit is contained in:
@@ -31,8 +31,7 @@ class ValidEmailDomainRegex(object):
|
|||||||
message = (
|
message = (
|
||||||
'Enter a central government email address.'
|
'Enter a central government email address.'
|
||||||
' If you think you should have access'
|
' If you think you should have access'
|
||||||
' <a href="{}">contact us</a>').format(
|
' <a href="{}">contact us</a>').format(url_for('main.feedback'))
|
||||||
"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.lower()):
|
if not re.match(email_regex, field.data.lower()):
|
||||||
|
|||||||
@@ -6,14 +6,15 @@ from unittest.mock import Mock
|
|||||||
|
|
||||||
|
|
||||||
def test_should_raise_validation_error_for_password(app_, mock_get_user_by_email):
|
def test_should_raise_validation_error_for_password(app_, mock_get_user_by_email):
|
||||||
form = RegisterUserForm()
|
with app_.test_request_context():
|
||||||
form.name.data = 'test'
|
form = RegisterUserForm()
|
||||||
form.email_address.data = 'teset@example.gov.uk'
|
form.name.data = 'test'
|
||||||
form.mobile_number.data = '441231231231'
|
form.email_address.data = 'teset@example.gov.uk'
|
||||||
form.password.data = 'password1234'
|
form.mobile_number.data = '441231231231'
|
||||||
|
form.password.data = 'password1234'
|
||||||
|
|
||||||
form.validate()
|
form.validate()
|
||||||
assert 'That password is blacklisted, too common' in form.errors['password']
|
assert 'That password is blacklisted, too common' in form.errors['password']
|
||||||
|
|
||||||
|
|
||||||
def test_valid_email_not_in_valid_domains(app_):
|
def test_valid_email_not_in_valid_domains(app_):
|
||||||
|
|||||||
Reference in New Issue
Block a user