From 1441044415c6de252bc89b83c6dd8d6b2f9de2ca Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Mon, 27 Feb 2023 10:12:30 -0700 Subject: [PATCH 1/8] Process of removal security email from the codes --- src/registrar/config/urls.py | 1 - src/registrar/forms/application_wizard.py | 14 ++------------ src/registrar/tests/test_forms.py | 14 -------------- src/registrar/views/application.py | 6 ------ 4 files changed, 2 insertions(+), 33 deletions(-) diff --git a/src/registrar/config/urls.py b/src/registrar/config/urls.py index 72c0604a0..2434511b9 100644 --- a/src/registrar/config/urls.py +++ b/src/registrar/config/urls.py @@ -35,7 +35,6 @@ for step, view in [ (Step.PURPOSE, views.Purpose), (Step.YOUR_CONTACT, views.YourContact), (Step.OTHER_CONTACTS, views.OtherContacts), - (Step.SECURITY_EMAIL, views.SecurityEmail), (Step.ANYTHING_ELSE, views.AnythingElse), (Step.REQUIREMENTS, views.Requirements), (Step.REVIEW, views.Review), diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index 76e10ad8b..d70c911b0 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -28,8 +28,10 @@ class RegistrarForm(forms.Form): def __init__(self, *args, **kwargs): kwargs.setdefault("label_suffix", "") # save a reference to an application object + archived = kwargs.pop('archived', None) self.application = kwargs.pop("application", None) super(RegistrarForm, self).__init__(*args, **kwargs) + self.fields['archived'] = forms.BooleanField(initial=archived, required=False) def to_database(self, obj: DomainApplication | Contact): """ @@ -672,18 +674,6 @@ class NoOtherContactsForm(RegistrarForm): ) -class SecurityEmailForm(RegistrarForm): - security_email = forms.EmailField( - required=False, - label="Security email for public use", - error_messages={ - "invalid": ( - "Enter an email address in the required format, like name@example.com." - ) - }, - ) - - class AnythingElseForm(RegistrarForm): anything_else = forms.CharField( required=False, diff --git a/src/registrar/tests/test_forms.py b/src/registrar/tests/test_forms.py index b021e559c..2ad81e643 100644 --- a/src/registrar/tests/test_forms.py +++ b/src/registrar/tests/test_forms.py @@ -9,7 +9,6 @@ from registrar.forms.application_wizard import ( OrganizationContactForm, YourContactForm, OtherContactsForm, - SecurityEmailForm, RequirementsForm, TribalGovernmentForm, ) @@ -117,19 +116,6 @@ class TestFormValidation(TestCase): form.errors["phone"][0].startswith("Enter a valid phone number") ) - def test_security_email_form_blank(self): - """Can leave the security_email field blank.""" - form = SecurityEmailForm(data={}) - self.assertEqual(len(form.errors), 0) - - def test_security_email_form_invalid(self): - """Can leave the security_email field blank.""" - form = SecurityEmailForm(data={"security_email": "boss@boss"}) - self.assertEqual( - form.errors["security_email"], - ["Enter an email address in the required format, like name@example.com."], - ) - def test_requirements_form_blank(self): """Requirements box unchecked is an error.""" form = RequirementsForm(data={}) diff --git a/src/registrar/views/application.py b/src/registrar/views/application.py index c34a8e1c1..932d528b8 100644 --- a/src/registrar/views/application.py +++ b/src/registrar/views/application.py @@ -37,7 +37,6 @@ class Step(StrEnum): PURPOSE = "purpose" YOUR_CONTACT = "your_contact" OTHER_CONTACTS = "other_contacts" - SECURITY_EMAIL = "security_email" ANYTHING_ELSE = "anything_else" REQUIREMENTS = "requirements" REVIEW = "review" @@ -82,7 +81,6 @@ class ApplicationWizard(LoginRequiredMixin, TemplateView): Step.PURPOSE: _("Purpose of your domain"), Step.YOUR_CONTACT: _("Your contact information"), Step.OTHER_CONTACTS: _("Other contacts for your organization"), - Step.SECURITY_EMAIL: _("Security email for public use"), Step.ANYTHING_ELSE: _("Anything else we should know?"), Step.REQUIREMENTS: _( "Requirements for registration and operation of .gov domains" @@ -428,10 +426,6 @@ class OtherContacts(ApplicationWizard): forms = [forms.OtherContactsFormSet, forms.NoOtherContactsForm] -class SecurityEmail(ApplicationWizard): - template_name = "application_security_email.html" - forms = [forms.SecurityEmailForm] - class AnythingElse(ApplicationWizard): template_name = "application_anything_else.html" From b12e97f6744933949e025a8e6df83abf6e55a316 Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Mon, 27 Feb 2023 10:30:44 -0700 Subject: [PATCH 2/8] removing security from test cases. still need to clean up --- src/.pa11yci | 1 - src/registrar/fixtures.py | 2 -- src/registrar/migrations/0001_initial.py | 9 ------ src/registrar/models/domain_application.py | 7 ----- .../templates/application_review.html | 3 -- .../templates/application_security_email.html | 14 --------- src/registrar/tests/test_views.py | 31 ++----------------- 7 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 src/registrar/templates/application_security_email.html diff --git a/src/.pa11yci b/src/.pa11yci index 72d14bd93..ce70e8537 100644 --- a/src/.pa11yci +++ b/src/.pa11yci @@ -14,7 +14,6 @@ "http://app:8080/register/purpose/", "http://app:8080/register/your_contact/", "http://app:8080/register/other_contacts/", - "http://app:8080/register/security_email/", "http://app:8080/register/anything_else/", "http://app:8080/register/requirements/", "http://app:8080/register/review/", diff --git a/src/registrar/fixtures.py b/src/registrar/fixtures.py index 4c66bcd2e..36c1733c5 100644 --- a/src/registrar/fixtures.py +++ b/src/registrar/fixtures.py @@ -89,7 +89,6 @@ class DomainApplicationFixture: # "zipcode": None, # "urbanization": None, # "purpose": None, - # "security_email": None, # "anything_else": None, # "is_policy_acknowledged": None, # "authorizing_official": None, @@ -152,7 +151,6 @@ class DomainApplicationFixture: da.zipcode = app["zipcode"] if "zipcode" in app else fake.postalcode() da.urbanization = app["urbanization"] if "urbanization" in app else None da.purpose = app["purpose"] if "purpose" in app else fake.paragraph() - da.security_email = app["security_email"] if "security_email" in app else None da.anything_else = app["anything_else"] if "anything_else" in app else None da.is_policy_acknowledged = ( app["is_policy_acknowledged"] if "is_policy_acknowledged" in app else True diff --git a/src/registrar/migrations/0001_initial.py b/src/registrar/migrations/0001_initial.py index bae8d8636..760344cf3 100644 --- a/src/registrar/migrations/0001_initial.py +++ b/src/registrar/migrations/0001_initial.py @@ -312,15 +312,6 @@ class Migration(migrations.Migration): blank=True, help_text="Purpose of the domain", null=True ), ), - ( - "security_email", - models.CharField( - blank=True, - help_text="Security email for public use", - max_length=320, - null=True, - ), - ), ( "anything_else", models.TextField( diff --git a/src/registrar/models/domain_application.py b/src/registrar/models/domain_application.py index 7cfda1440..460204a1b 100644 --- a/src/registrar/models/domain_application.py +++ b/src/registrar/models/domain_application.py @@ -440,13 +440,6 @@ class DomainApplication(TimeStampedModel): help_text="Reason for listing no additional contacts", ) - security_email = models.CharField( - max_length=320, - null=True, - blank=True, - help_text="Security email for public use", - ) - anything_else = models.TextField( null=True, blank=True, diff --git a/src/registrar/templates/application_review.html b/src/registrar/templates/application_review.html index 7fed7f924..129fdb83d 100644 --- a/src/registrar/templates/application_review.html +++ b/src/registrar/templates/application_review.html @@ -75,9 +75,6 @@ None {% endfor %} {% endif %} - {% if step == Step.SECURITY_EMAIL %} - {{ application.security_email|default:"None" }} - {% endif %} {% if step == Step.ANYTHING_ELSE %} {{ application.anything_else|default:"No" }} {% endif %} diff --git a/src/registrar/templates/application_security_email.html b/src/registrar/templates/application_security_email.html deleted file mode 100644 index ff9d73c3c..000000000 --- a/src/registrar/templates/application_security_email.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends 'application_form.html' %} -{% load field_helpers %} - -{% block form_instructions %} -

We strongly recommend that you provide a security email. This email will allow the - public to report observed or suspected security issues on your domain. - Security emails are made public. We recommend using an alias, like - security@<domain.gov>.

-{% endblock %} - - -{% block form_fields %} - {% input_with_errors forms.0.security_email %} -{% endblock %} \ No newline at end of file diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index a168f83cb..62155622b 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -402,39 +402,14 @@ class DomainApplicationTests(TestWithUser, WebTest): self.assertEquals(other_contacts_result.status_code, 302) self.assertEquals( - other_contacts_result["Location"], "/register/security_email/" + other_contacts_result["Location"], "/register/anything_else/" ) num_pages_tested += 1 - # ---- SECURITY EMAIL PAGE ---- - # Follow the redirect to the next form page - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - security_email_page = other_contacts_result.follow() - security_email_form = security_email_page.form - - security_email_form["security_email-security_email"] = "security@city.com" - - # test saving the page - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - result = security_email_page.form.submit("submit_button", value="save") - # should remain on the same page - self.assertEquals(result["Location"], "/register/security_email/") - # should see results in db - application = DomainApplication.objects.get() # there's only one - self.assertEquals(application.security_email, "security@city.com") - - # test next button - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - security_email_result = security_email_form.submit() - - self.assertEquals(security_email_result.status_code, 302) - self.assertEquals(security_email_result["Location"], "/register/anything_else/") - num_pages_tested += 1 - # ---- ANYTHING ELSE PAGE ---- # Follow the redirect to the next form page self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - anything_else_page = security_email_result.follow() + anything_else_page = other_contacts_result.follow() anything_else_form = anything_else_page.form anything_else_form["anything_else-anything_else"] = "Nothing else." @@ -516,7 +491,6 @@ class DomainApplicationTests(TestWithUser, WebTest): self.assertContains(review_page, "Another Tester") self.assertContains(review_page, "testy2@town.com") self.assertContains(review_page, "(201) 555-5557") - self.assertContains(review_page, "security@city.com") self.assertContains(review_page, "Nothing else.") # test saving the page @@ -986,7 +960,6 @@ class DomainApplicationTests(TestWithUser, WebTest): organization_type="federal", federal_type="executive", purpose="Purpose of the site", - security_email="security@city.com", anything_else="No", is_policy_acknowledged=True, organization_name="Testorg", From ecaa870005f0b2e933e34bd7d3c90180a1be3594 Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Mon, 27 Feb 2023 10:54:36 -0700 Subject: [PATCH 3/8] Cleaning up a little more --- src/registrar/forms/application_wizard.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index d70c911b0..d71332c48 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -28,10 +28,8 @@ class RegistrarForm(forms.Form): def __init__(self, *args, **kwargs): kwargs.setdefault("label_suffix", "") # save a reference to an application object - archived = kwargs.pop('archived', None) self.application = kwargs.pop("application", None) super(RegistrarForm, self).__init__(*args, **kwargs) - self.fields['archived'] = forms.BooleanField(initial=archived, required=False) def to_database(self, obj: DomainApplication | Contact): """ From e70401e1fd6f8bf921cd758c2d721cb94821a397 Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Mon, 27 Feb 2023 10:57:05 -0700 Subject: [PATCH 4/8] reverting migration modification --- src/registrar/migrations/0001_initial.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/registrar/migrations/0001_initial.py b/src/registrar/migrations/0001_initial.py index 760344cf3..bae8d8636 100644 --- a/src/registrar/migrations/0001_initial.py +++ b/src/registrar/migrations/0001_initial.py @@ -312,6 +312,15 @@ class Migration(migrations.Migration): blank=True, help_text="Purpose of the domain", null=True ), ), + ( + "security_email", + models.CharField( + blank=True, + help_text="Security email for public use", + max_length=320, + null=True, + ), + ), ( "anything_else", models.TextField( From 2e002c81bf041818eca83c38967ecff90faba2e8 Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Mon, 27 Feb 2023 11:36:02 -0700 Subject: [PATCH 5/8] remove security email migrations --- ...11_remove_domainapplication_security_email.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/registrar/migrations/0011_remove_domainapplication_security_email.py diff --git a/src/registrar/migrations/0011_remove_domainapplication_security_email.py b/src/registrar/migrations/0011_remove_domainapplication_security_email.py new file mode 100644 index 000000000..c717408da --- /dev/null +++ b/src/registrar/migrations/0011_remove_domainapplication_security_email.py @@ -0,0 +1,16 @@ +# Generated by Django 4.1.6 on 2023-02-27 18:35 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("registrar", "0010_domainapplication_no_other_contacts_rationale"), + ] + + operations = [ + migrations.RemoveField( + model_name="domainapplication", + name="security_email", + ), + ] From dc7a4f438930e45928e4429e8520b7b6865f08e5 Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Mon, 27 Feb 2023 11:48:22 -0700 Subject: [PATCH 6/8] Linting --- src/registrar/tests/test_views.py | 4 +--- src/registrar/views/application.py | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index 62155622b..e540e297d 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -401,9 +401,7 @@ class DomainApplicationTests(TestWithUser, WebTest): other_contacts_result = other_contacts_form.submit() self.assertEquals(other_contacts_result.status_code, 302) - self.assertEquals( - other_contacts_result["Location"], "/register/anything_else/" - ) + self.assertEquals(other_contacts_result["Location"], "/register/anything_else/") num_pages_tested += 1 # ---- ANYTHING ELSE PAGE ---- diff --git a/src/registrar/views/application.py b/src/registrar/views/application.py index 932d528b8..d5cef38c4 100644 --- a/src/registrar/views/application.py +++ b/src/registrar/views/application.py @@ -426,7 +426,6 @@ class OtherContacts(ApplicationWizard): forms = [forms.OtherContactsFormSet, forms.NoOtherContactsForm] - class AnythingElse(ApplicationWizard): template_name = "application_anything_else.html" forms = [forms.AnythingElseForm] From 066217ccd5a56aba1d09f1f831c15f267710662a Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Mon, 27 Feb 2023 12:18:06 -0700 Subject: [PATCH 7/8] Forgot to save. Homer-backs-into-bushes.gif --- src/registrar/tests/test_models.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/registrar/tests/test_models.py b/src/registrar/tests/test_models.py index 868585cc8..911b73086 100644 --- a/src/registrar/tests/test_models.py +++ b/src/registrar/tests/test_models.py @@ -47,7 +47,6 @@ class TestDomainApplication(TestCase): requested_domain=domain, submitter=contact, purpose="Igorville rules!", - security_email="security@igorville.gov", anything_else="All of Igorville loves the dotgov program.", is_policy_acknowledged=True, ) From 8e7cad668530e5d874f20caea4d1bcb47a696ee0 Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Tue, 28 Feb 2023 09:20:36 -0700 Subject: [PATCH 8/8] Fixed one line that didnt merged correctly --- src/registrar/views/application.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/registrar/views/application.py b/src/registrar/views/application.py index 4ea927396..a5b6601c1 100644 --- a/src/registrar/views/application.py +++ b/src/registrar/views/application.py @@ -82,6 +82,7 @@ class ApplicationWizard(LoginRequiredMixin, TemplateView): Step.PURPOSE: _("Purpose of your domain"), Step.YOUR_CONTACT: _("Your contact information"), Step.OTHER_CONTACTS: _("Other employees from your organization"), + Step.NO_OTHER_CONTACTS: _("No other employees from your organization?"), Step.ANYTHING_ELSE: _("Anything else we should know?"), Step.REQUIREMENTS: _( "Requirements for registration and operation of .gov domains"