mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-20 17:56:11 +02:00
Merge branch 'main' into za/additional-data-transferred-domains
This commit is contained in:
commit
6f528e8330
9 changed files with 19 additions and 19 deletions
|
@ -136,7 +136,7 @@ class DomainInvitation {
|
|||
--
|
||||
}
|
||||
DomainInvitation -- Domain
|
||||
DomainInvitation .[#green].> UserDomainRole : User.first_login()
|
||||
DomainInvitation .[#green].> UserDomainRole : User.on_each_login()
|
||||
|
||||
actor applicant #Red
|
||||
applicant -d-> DomainApplication : **/register**
|
||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
@ -49,13 +49,13 @@ class OpenIdConnectBackend(ModelBackend):
|
|||
user, created = UserModel.objects.update_or_create(**args)
|
||||
if created:
|
||||
user = self.configure_user(user, **kwargs)
|
||||
# run a newly created user's callback for a first-time login
|
||||
user.first_login()
|
||||
else:
|
||||
try:
|
||||
user = UserModel.objects.get_by_natural_key(username)
|
||||
except UserModel.DoesNotExist:
|
||||
return None
|
||||
# run this callback for a each login
|
||||
user.on_each_login()
|
||||
return user
|
||||
|
||||
def clean_username(self, username):
|
||||
|
|
|
@ -154,10 +154,10 @@ class User(AbstractUser):
|
|||
new_domain_info = DomainInformation(creator=self, domain=domain)
|
||||
new_domain_info.save()
|
||||
|
||||
def first_login(self):
|
||||
"""Callback when the user is authenticated for the very first time.
|
||||
def on_each_login(self):
|
||||
"""Callback each time the user is authenticated.
|
||||
|
||||
When a user first arrives on the site, we need to retrieve any domain
|
||||
When a user arrives on the site each time, we need to retrieve any domain
|
||||
invitations that match their email address.
|
||||
|
||||
We also need to check if they are logging in with the same e-mail
|
||||
|
|
|
@ -25,7 +25,7 @@ This is a good time to check who has access to your .gov domain{% if domains|len
|
|||
2. Click the “Manage” link next to your .gov domain, then click on “Domain managers” to see who has access to your domain.
|
||||
3. If any of these users should not have access to your domain, let us know in a reply to this email.
|
||||
|
||||
After verifying who has access to your domain{% if domains|length > 1 %}s{% endif %}, we also suggest reviewing your contact information and organization mailing address to ensure those are up to date.
|
||||
After verifying who has access to your domain{% if domains|length > 1 %}s{% endif %}, review your contact information to make sure it's up to date.
|
||||
|
||||
|
||||
DOMAIN EXPIRATION DATES EXTENDED BY ONE YEAR
|
||||
|
|
|
@ -139,7 +139,7 @@
|
|||
></div>
|
||||
{% else %}
|
||||
<p>You don't have any active domain requests right now</p>
|
||||
<p><a href="{% url 'application:' %}" class="usa-button">Start a new domain request</a></p>
|
||||
<!-- <p><a href="{% url 'application:' %}" class="usa-button">Start a new domain request</a></p> -->
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
|
|
|
@ -609,9 +609,9 @@ class TestInvitations(TestCase):
|
|||
self.invitation.retrieve()
|
||||
self.assertEqual(self.invitation.status, DomainInvitation.RETRIEVED)
|
||||
|
||||
def test_retrieve_on_first_login(self):
|
||||
"""A new user's first_login callback retrieves their invitations."""
|
||||
self.user.first_login()
|
||||
def test_retrieve_on_each_login(self):
|
||||
"""A user's authenticate on_each_login callback retrieves their invitations."""
|
||||
self.user.on_each_login()
|
||||
self.assertTrue(UserDomainRole.objects.get(user=self.user, domain=self.domain))
|
||||
|
||||
|
||||
|
@ -640,19 +640,19 @@ class TestUser(TestCase):
|
|||
User.objects.all().delete()
|
||||
|
||||
def test_check_transition_domains_on_login(self):
|
||||
"""A new user's first_login callback checks transition domains.
|
||||
"""A user's on_each_login callback checks transition domains.
|
||||
Makes DomainInformation object."""
|
||||
self.domain, _ = Domain.objects.get_or_create(name=self.domain_name)
|
||||
|
||||
self.user.first_login()
|
||||
self.user.on_each_login()
|
||||
self.assertTrue(DomainInformation.objects.get(domain=self.domain))
|
||||
|
||||
def test_check_transition_domains_without_domains_on_login(self):
|
||||
"""A new user's first_login callback checks transition domains.
|
||||
"""A user's on_each_login callback checks transition domains.
|
||||
This test makes sure that in the event a domain does not exist
|
||||
for a given transition domain, both a domain and domain invitation
|
||||
are created."""
|
||||
self.user.first_login()
|
||||
self.user.on_each_login()
|
||||
self.assertTrue(Domain.objects.get(name=self.domain_name))
|
||||
|
||||
domain = Domain.objects.get(name=self.domain_name)
|
||||
|
|
|
@ -355,7 +355,7 @@ class TestMigrations(TestCase):
|
|||
user, user_created = User.objects.get_or_create(
|
||||
email=invite.email, username=invite.email
|
||||
)
|
||||
user.first_login()
|
||||
user.on_each_login()
|
||||
|
||||
# Analyze the tables
|
||||
expected_total_transition_domains = 9
|
||||
|
|
|
@ -1457,8 +1457,8 @@ class TestDomainManagers(TestDomainOverview):
|
|||
new_user = User.objects.create(username=EMAIL, email=EMAIL)
|
||||
# log them in to `self.app`
|
||||
self.app.set_user(new_user.username)
|
||||
# and manually call the first login callback
|
||||
new_user.first_login()
|
||||
# and manually call the on each login callback
|
||||
new_user.on_each_login()
|
||||
|
||||
# Now load the home page and make sure our domain appears there
|
||||
home_page = self.app.get(reverse("home"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue