From fee659d1c400d645bacf95c4038a823d63690642 Mon Sep 17 00:00:00 2001
From: Neil Martinsen-Burrell .Gov domain names are for use on the internet. Don’t register a .gov to simply reserve a
@@ -8,7 +8,7 @@ domain name or for mainly internal use. Describe the reason for your domain request. Explain how you plan to use this domain.
Who is your intended audience? Will you use it for a website and/or email? Are you moving
your website from another top-level domain (like .com or .org)?
-Read about activities that are prohibited on .gov domains.PlantUML source code
+```plantuml
+@startuml
allowmixing
left to right direction
@@ -130,4 +135,7 @@ user2 -[#green]-> DomainInformation : **/domain/PlantUML source code
+```plantuml
@startuml
class "registrar.Contact PlantUML source code
diff --git a/docs/architecture/diagrams/models_diagram.md b/docs/architecture/diagrams/models_diagram.md
index 95d8c0a58..23e4091e8 100644
--- a/docs/architecture/diagrams/models_diagram.md
+++ b/docs/architecture/diagrams/models_diagram.md
@@ -8,7 +8,7 @@ using the command
$ docker compose app ./manage.py generate_puml --include registrar
```
-![./models_diagram.svg]
+
PlantUML source code
From 0407cf63dab2d97f6dfa4e6bb7c3213071b8c89f Mon Sep 17 00:00:00 2001
From: Neil Martinsen-Burrell PlantUML source code
+
```plantuml
@startuml
@@ -138,4 +139,5 @@ user3 -right[#green]-> DomainInvitation : **/domain/PlantUML source code
+
```plantuml
@startuml
class "registrar.Contact PlantUML source code
+To regenerate this image using Docker, run
+
+```bash
+$ docker run -v $(pwd):$(pwd) -w $(pwd) -it plantuml/plantuml -tsvg model_timeline.md
+```
+
```plantuml
@startuml
diff --git a/docs/architecture/diagrams/model_timeline.svg b/docs/architecture/diagrams/model_timeline.svg
index fb466ec21..cf2eea238 100644
--- a/docs/architecture/diagrams/model_timeline.svg
+++ b/docs/architecture/diagrams/model_timeline.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/docs/architecture/diagrams/models_diagram.md b/docs/architecture/diagrams/models_diagram.md
index 04d95ee09..77fa36707 100644
--- a/docs/architecture/diagrams/models_diagram.md
+++ b/docs/architecture/diagrams/models_diagram.md
@@ -13,6 +13,12 @@ $ docker compose app ./manage.py generate_puml --include registrar
PlantUML source code
+To regenerate this image using Docker, run
+
+```bash
+$ docker run -v $(pwd):$(pwd) -w $(pwd) -it plantuml/plantuml -tsvg models_diagram.md
+```
+
```plantuml
@startuml
class "registrar.Contact
- {{ title }} -
- {% if address %} - {% include "includes/organization_address.html" with organization=value %} - {% elif contact %} - {% if list %} - {% if value|length == 1 %} - {% include "includes/contact.html" with contact=value|first %} - {% else %} -- Conatct {{forloop.counter}} -
- {% include "includes/contact.html" with contact=item %}{{ value | first }}
- {% else %} -- {{ value }} -
- {% endif %} - ++ {{ title }} +
+ {% if address %} + {% include "includes/organization_address.html" with organization=value %} + {% elif contact %} + {% if list %} + {% if value|length == 1 %} + {% include "includes/contact.html" with contact=value|first %} + {% else %} ++ Conatct {{forloop.counter}} +
+ {% include "includes/contact.html" with contact=item %}{{ value | first }}
+ {% else %} +{{ user.email }} ({{ value.first.role }})
+ {% else %} ++ {{ value }} +
+ {% endif %} +Active: {% if domain.is_active %}Yes{% else %}No{% endif %}
+ org type: {{domain.domain_info.organization_type}} + + {% url 'domain-nameservers' pk=domain.id as url %} + {% include "includes/summary_item.html" with title='DNS name servers' value=domain.nameservers list='true' edit_link=url %} + + {% url 'todo' as url %} + {% if domain.domain_info.organization_name %} + {% include "includes/summary_item.html" with title='Organization name and mailing address' value=domain.domain_info address='true' edit_link=url %} + {% endif %} + + {% if domain.domain_info.authorizing_official %} + {% url 'todo' as url %} + {% include "includes/summary_item.html" with title='Authorizing official' value=domain.domain_info.authorizing_official contact='true' edit_link=url %} + {% endif %} + + {% if domain.domain_info.submitter %} + {% url 'todo' as url %} + {% include "includes/summary_item.html" with title='Your contact information' value='---TODO---' edit_link=url %} + {% endif %} + + {% url 'todo' as url %} + {% include "includes/summary_item.html" with title='Security email' value=domain.domain_info.security_email edit_link=url %} + + {% url 'domain-users' pk=domain.id as url %} + {% include "includes/summary_item.html" with title='User management' users='true' value=domain.permissions.all edit_link=url %} + {% endblock %} {# domain_content #} From 23672f426510ef4d44acfa388ad6159f25a72599 Mon Sep 17 00:00:00 2001 From: rachidatecs+
{{ value }}
{% endif %} @@ -66,7 +66,6 @@ {% if edit_link %} Edit {{ title }} From e17bca1a99d6e4af58ebc7678d5e1f1192122fa3 Mon Sep 17 00:00:00 2001 From: igorkorenfeldActive: {% if domain.is_active %}Yes{% else %}No{% endif %}
- org type: {{domain.domain_info.organization_type}} +No DNS name servers have been added yet. Before your domain can be used we’ll need information about your domain name servers.
+ Add DNS name servers + {% endif %} - {% url 'todo' as url %} - {% if domain.domain_info.organization_name %} + {% url 'todo' as url %} {% include "includes/summary_item.html" with title='Organization name and mailing address' value=domain.domain_info address='true' edit_link=url %} - {% endif %} - {% if domain.domain_info.authorizing_official %} {% url 'todo' as url %} {% include "includes/summary_item.html" with title='Authorizing official' value=domain.domain_info.authorizing_official contact='true' edit_link=url %} - {% endif %} - {% if domain.domain_info.submitter %} {% url 'todo' as url %} {% include "includes/summary_item.html" with title='Your contact information' value='---TODO---' edit_link=url %} - {% endif %} - {% url 'todo' as url %} - {% include "includes/summary_item.html" with title='Security email' value=domain.domain_info.security_email edit_link=url %} + {% url 'todo' as url %} + {% include "includes/summary_item.html" with title='Security email' value=domain.domain_info.security_email edit_link=url %} - {% url 'domain-users' pk=domain.id as url %} - {% include "includes/summary_item.html" with title='User management' users='true' value=domain.permissions.all edit_link=url %} + {% url 'domain-users' pk=domain.id as url %} + {% include "includes/summary_item.html" with title='User management' users='true' value=domain.permissions.all edit_link=url %} +{{ value | first }}
+{{ value | first }}
{% else %}{{ user.email }} ({{ value.first.role }})
+{{ user.email }} ({{ value.first.role }})
{% else %}- Conatct {{forloop.counter}} + Contact {{forloop.counter}}
{% include "includes/contact.html" with contact=item %}If you’d like us to use a different name, email, or phone number you can make those changes below. Changing your contact information here won’t affect your Login.gov account information.
+ + {% include "includes/required_fields.html" %} + + + +{% endblock %} {# domain_content #} diff --git a/src/registrar/views/__init__.py b/src/registrar/views/__init__.py index 820d0295d..758d04d72 100644 --- a/src/registrar/views/__init__.py +++ b/src/registrar/views/__init__.py @@ -2,6 +2,7 @@ from .application import * from .domain import ( DomainView, DomainNameserversView, + DomainYourContactInformationView, DomainSecurityEmailView, DomainUsersView, DomainAddUserView, diff --git a/src/registrar/views/domain.py b/src/registrar/views/domain.py index d0fa8952e..ec720ed25 100644 --- a/src/registrar/views/domain.py +++ b/src/registrar/views/domain.py @@ -10,9 +10,9 @@ from django.urls import reverse from django.views.generic import DetailView from django.views.generic.edit import DeleteView, FormMixin -from registrar.models import Domain, DomainInvitation, User, UserDomainRole +from registrar.models import Domain, DomainInvitation, User, UserDomainRole, DomainInformation -from ..forms import DomainAddUserForm, NameserverFormset, DomainSecurityEmailForm +from ..forms import DomainAddUserForm, NameserverFormset, DomainSecurityEmailForm, ContactForm from ..utility.email import send_templated_email, EmailSendingError from .utility import DomainPermission @@ -44,7 +44,7 @@ class DomainNameserversView(DomainPermission, FormMixin, DetailView): return [{"server": server} for server in domain.nameservers()] def get_success_url(self): - """Redirect to the overview page for the domain.""" + """Redirect to the nameservers page for the domain.""" return reverse("domain-nameservers", kwargs={"pk": self.object.pk}) def get_context_data(self, **kwargs): @@ -94,6 +94,64 @@ class DomainNameserversView(DomainPermission, FormMixin, DetailView): ) # superclass has the redirect return super().form_valid(formset) + + +class DomainYourContactInformationView(DomainPermission, FormMixin, DetailView): + + """Domain your contact information editing view.""" + + model = Domain + template_name = "domain_your_contact_information.html" + context_object_name = "domain" + form_class = ContactForm + + # def get_initial(self): + # """The initial value for the form.""" + # domainInformation = self.get_object() + # initial = super().get_initial() + # initial["first_name"] = domainInformation.submitter.first_name + # initial["middle_name"] = domainInformation.submitter.middle_name + # initial["last_name"] = domainInformation.submitter.last_name + # initial["title"] = domainInformation.submitter.title + # initial["email"] = domainInformation.submitter.email + # initial["phone"] = domainInformation.submitter.phone + # return initial + + def get_form_kwargs(self, *args, **kwargs): + """Add domain_info.submitter instance to make a bound form.""" + form_kwargs = super().get_form_kwargs(*args, **kwargs) + form_kwargs["instance"] = self.get_object().domain_info.submitter + return form_kwargs + + def get_success_url(self): + """Redirect to the your contact information for the domain.""" + return reverse("domain-your-contact-information", kwargs={"pk": self.object.pk}) + + def post(self, request, *args, **kwargs): + """Form submission posts to this view.""" + self.object = self.get_object() + form = self.get_form() + if form.is_valid(): + # there is a valid email address in the form + return self.form_valid(form) + else: + return self.form_invalid(form) + + def form_valid(self, form): + """The form is valid, call setter in model.""" + + # Post to DB using values from the form + # new_email = form.cleaned_data["security_email"] + # domain = self.get_object() + # domain.set_security_email(new_email) + domain = self.get_object() + form.save() + + messages.success( + self.request, "Your contact information for this domain have been updated." + ) + # superclass has the redirect + return super().form_valid(form) class DomainSecurityEmailView(DomainPermission, FormMixin, DetailView): @@ -113,11 +171,11 @@ class DomainSecurityEmailView(DomainPermission, FormMixin, DetailView): return initial def get_success_url(self): - """Redirect to the overview page for the domain.""" + """Redirect to the security email page for the domain.""" return reverse("domain-security-email", kwargs={"pk": self.object.pk}) def post(self, request, *args, **kwargs): - """Formset submission posts to this view.""" + """Form submission posts to this view.""" self.object = self.get_object() form = self.get_form() if form.is_valid(): diff --git a/src/zap.conf b/src/zap.conf index ee92e8a1c..6a5e9bf77 100644 --- a/src/zap.conf +++ b/src/zap.conf @@ -52,6 +52,7 @@ 10038 OUTOFSCOPE http://app:8080/users 10038 OUTOFSCOPE http://app:8080/users/add 10038 OUTOFSCOPE http://app:8080/nameservers +10038 OUTOFSCOPE http://app:8080/your-contact-information 10038 OUTOFSCOPE http://app:8080/security-email 10038 OUTOFSCOPE http://app:8080/delete 10038 OUTOFSCOPE http://app:8080/withdraw From 1876f08ca655001c60c2bad01368a18678ce1cc2 Mon Sep 17 00:00:00 2001 From: rachidatecs