mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 09:21:54 +02:00
Merge pull request #1026 from cisagov/rh/482-youve-been-added-to-domain
482 -- Domain Invitation to You've Been Added To A Domain!
This commit is contained in:
commit
4d4a14a187
5 changed files with 54 additions and 6 deletions
|
@ -1,6 +1,32 @@
|
|||
You have been invited to manage the domain {{ domain.name }} on get.gov,
|
||||
the registrar for .gov domain names.
|
||||
{% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #}
|
||||
Hi.
|
||||
|
||||
To accept your invitation, go to <{{ domain_url }}>.
|
||||
{{ full_name }} has added you as a manager on {{ domain.name }}.
|
||||
|
||||
You will need to log in with a Login.gov account using this email address.
|
||||
YOU NEED A LOGIN.GOV ACCOUNT
|
||||
You’ll need a Login.gov account to manage your .gov domain. Login.gov provides
|
||||
a simple and secure process for signing into many government services with one
|
||||
account. If you don’t already have one, follow these steps to create your
|
||||
Login.gov account <https://login.gov/help/get-started/create-your-account/>.
|
||||
|
||||
DOMAIN MANAGEMENT
|
||||
As a .gov domain manager you can add or update information about your domain.
|
||||
You’ll also serve as a contact for your .gov domain. Please keep your contact
|
||||
information updated. Learn more about domain management <https://get.gov/help/>.
|
||||
|
||||
SOMETHING WRONG?
|
||||
If you’re not affiliated with {{ domain.name }} or think you received this
|
||||
message in error, contact the .gov team <https://get.gov/help/#contact-us>.
|
||||
|
||||
|
||||
THANK YOU
|
||||
|
||||
.Gov helps the public identify official, trusted information. Thank you for
|
||||
using a .gov domain.
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
The .gov team
|
||||
Contact us: <https://get.gov/contact/>
|
||||
Visit <https://get.gov>
|
||||
{% endautoescape %}
|
|
@ -1 +1 @@
|
|||
You are invited to manage {{ domain.name }} on get.gov
|
||||
You’ve been added to a .gov domain
|
|
@ -457,6 +457,7 @@ def completed_application(
|
|||
has_anything_else=True,
|
||||
status=DomainApplication.STARTED,
|
||||
user=False,
|
||||
name="city.gov",
|
||||
):
|
||||
"""A completed domain application."""
|
||||
if not user:
|
||||
|
@ -468,7 +469,7 @@ def completed_application(
|
|||
email="testy@town.com",
|
||||
phone="(555) 555 5555",
|
||||
)
|
||||
domain, _ = DraftDomain.objects.get_or_create(name="city.gov")
|
||||
domain, _ = DraftDomain.objects.get_or_create(name=name)
|
||||
alt, _ = Website.objects.get_or_create(website="city1.gov")
|
||||
current, _ = Website.objects.get_or_create(website="city.com")
|
||||
you, _ = Contact.objects.get_or_create(
|
||||
|
|
|
@ -1079,6 +1079,7 @@ class TestWithDomainPermissions(TestWithUser):
|
|||
self.domain_information.delete()
|
||||
if hasattr(self.domain, "contacts"):
|
||||
self.domain.contacts.all().delete()
|
||||
DomainApplication.objects.all().delete()
|
||||
self.domain.delete()
|
||||
self.role.delete()
|
||||
except ValueError: # pass if already deleted
|
||||
|
@ -1197,6 +1198,10 @@ class TestDomainDetail(TestWithDomainPermissions, WebTest):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
self.domain_information, _ = DomainInformation.objects.get_or_create(
|
||||
creator=self.user, domain=self.domain
|
||||
)
|
||||
|
||||
add_page = self.app.get(
|
||||
reverse("domain-users-add", kwargs={"pk": self.domain.id})
|
||||
)
|
||||
|
@ -1218,6 +1223,10 @@ class TestDomainDetail(TestWithDomainPermissions, WebTest):
|
|||
EMAIL = "mayor@igorville.gov"
|
||||
User.objects.filter(email=EMAIL).delete()
|
||||
|
||||
self.domain_information, _ = DomainInformation.objects.get_or_create(
|
||||
creator=self.user, domain=self.domain
|
||||
)
|
||||
|
||||
mock_client = MagicMock()
|
||||
mock_client_instance = mock_client.return_value
|
||||
with boto3_mocking.clients.handler_for("sesv2", mock_client):
|
||||
|
@ -1270,6 +1279,11 @@ class TestDomainDetail(TestWithDomainPermissions, WebTest):
|
|||
add_page = self.app.get(
|
||||
reverse("domain-users-add", kwargs={"pk": self.domain.id})
|
||||
)
|
||||
|
||||
self.domain_information, _ = DomainInformation.objects.get_or_create(
|
||||
creator=self.user, domain=self.domain
|
||||
)
|
||||
|
||||
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
|
||||
add_page.form["email"] = EMAIL
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
|
|
@ -16,6 +16,7 @@ from django.views.generic.edit import FormMixin
|
|||
|
||||
from registrar.models import (
|
||||
Domain,
|
||||
DomainInformation,
|
||||
DomainInvitation,
|
||||
User,
|
||||
UserDomainRole,
|
||||
|
@ -335,6 +336,11 @@ class DomainAddUserView(DomainPermissionView, FormMixin):
|
|||
)
|
||||
else:
|
||||
# created a new invitation in the database, so send an email
|
||||
domaininfo = DomainInformation.objects.filter(domain=self.object)
|
||||
first = domaininfo.first().creator.first_name
|
||||
last = domaininfo.first().creator.last_name
|
||||
full_name = f"{first} {last}"
|
||||
|
||||
try:
|
||||
send_templated_email(
|
||||
"emails/domain_invitation.txt",
|
||||
|
@ -343,6 +349,7 @@ class DomainAddUserView(DomainPermissionView, FormMixin):
|
|||
context={
|
||||
"domain_url": self._domain_abs_url(),
|
||||
"domain": self.object,
|
||||
"full_name": full_name,
|
||||
},
|
||||
)
|
||||
except EmailSendingError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue