From b92fe3f4697c0dd438ee32528c2aab5ed6ddb10f Mon Sep 17 00:00:00 2001 From: Seamus Johnston Date: Thu, 17 Nov 2022 09:50:56 -0600 Subject: [PATCH 1/5] Show domain applications on home --- src/registrar/templates/home.html | 32 +++++++++++++++++++++++++++++-- src/registrar/views/index.py | 8 +++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/registrar/templates/home.html b/src/registrar/templates/home.html index f6601d25c..c6de271d1 100644 --- a/src/registrar/templates/home.html +++ b/src/registrar/templates/home.html @@ -17,9 +17,37 @@

This is the .gov registrar.

{% if user.is_authenticated %} -

Click here to log out.

+ +{% if domain_applications %} +

Your domain applications

+ + + + + + + + + + {% for application in domain_applications %} + + + + + {% endfor %} + +
Your domain applications
NameStatus
{{ application.requested_domain.website }}{{ application.status }}
+{% endif %} + +

Apply

+ +

Edit profile

+ +

CISA admin panel

+ +

Click here to log out.

{% else %} -

Click here to log in.

+

Click here to log in.

{% endif %} {% endblock %} diff --git a/src/registrar/views/index.py b/src/registrar/views/index.py index e4acc7818..6d50b3948 100644 --- a/src/registrar/views/index.py +++ b/src/registrar/views/index.py @@ -1,6 +1,12 @@ from django.shortcuts import render +from registrar.models import DomainApplication + def index(request): """This page is available to anyone without logging in.""" - return render(request, "home.html") + context = {} + if request.user.is_authenticated: + applications = DomainApplication.objects.filter(creator=request.user) + context["domain_applications"] = applications + return render(request, "home.html", context) From f4122767279a13ad8546ff00d3b3b4da7eb3de12 Mon Sep 17 00:00:00 2001 From: Seamus Johnston Date: Thu, 17 Nov 2022 09:51:10 -0600 Subject: [PATCH 2/5] Fix heading levels --- src/registrar/templates/404.html | 2 +- src/registrar/templates/home.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/registrar/templates/404.html b/src/registrar/templates/404.html index cac4df5d0..cbc4e89b0 100644 --- a/src/registrar/templates/404.html +++ b/src/registrar/templates/404.html @@ -6,7 +6,7 @@ {% block content %} -

{% translate "Page not found" %}

+

{% translate "Page not found" %}

{% translate "The requested page could not be found." %}

diff --git a/src/registrar/templates/home.html b/src/registrar/templates/home.html index c6de271d1..5235cb246 100644 --- a/src/registrar/templates/home.html +++ b/src/registrar/templates/home.html @@ -6,9 +6,9 @@
-

+

Welcome to the .gov registrar -

+
{% endblock %} From 1239f9d78a76d54983a45873d349c6f721a81638 Mon Sep 17 00:00:00 2001 From: Seamus Johnston Date: Mon, 21 Nov 2022 13:33:04 -0600 Subject: [PATCH 3/5] Only show admin link to staff --- src/registrar/templates/home.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/registrar/templates/home.html b/src/registrar/templates/home.html index 5235cb246..5bc9cb12f 100644 --- a/src/registrar/templates/home.html +++ b/src/registrar/templates/home.html @@ -43,7 +43,9 @@

Edit profile

+{% if user.is_staff %}

CISA admin panel

+{% endif %}

Click here to log out.

{% else %} From 7409674f494ba4de6273291e80b11f527a976d26 Mon Sep 17 00:00:00 2001 From: Seamus Johnston Date: Mon, 21 Nov 2022 14:46:51 -0600 Subject: [PATCH 4/5] Test application is added to list --- src/registrar/tests/test_views.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index 92b6df4df..150689a38 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -4,6 +4,8 @@ from django.contrib.auth import get_user_model from django_webtest import WebTest # type: ignore +from registrar.models import DomainApplication, Website + class TestViews(TestCase): def setUp(self): @@ -51,6 +53,18 @@ class LoggedInTests(TestWithUser): super().setUp() self.client.force_login(self.user) + def test_home_lists_domain_applications(self): + response = self.client.get("/") + self.assertNotContains(response, "igorville.gov") + site = Website.objects.create(website="igorville.gov") + application = DomainApplication.objects.create( + creator=self.user, requested_domain=site + ) + response = self.client.get("/") + self.assertContains(response, "igorville.gov", count=1) + # clean up + application.delete() + def test_whoami_page(self): """User information appears on the whoami page.""" response = self.client.get("/whoami/") From eca8da108b2dccff71273153b232d5396bfe1c6c Mon Sep 17 00:00:00 2001 From: Logan McDonald Date: Wed, 23 Nov 2022 09:43:43 -0800 Subject: [PATCH 5/5] add a note to development about the login time bug (#288) * add a note to development about the login time bug * Update docs/developer/README.md Co-authored-by: Neil MartinsenBurrell Co-authored-by: Neil MartinsenBurrell --- docs/developer/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/developer/README.md b/docs/developer/README.md index d58dd31ad..b9b79032a 100644 --- a/docs/developer/README.md +++ b/docs/developer/README.md @@ -123,3 +123,17 @@ In an effort to keep our domain logic centralized, we are representing the state objects in the application using the [django-fsm](https://github.com/viewflow/django-fsm) library. See the [ADR number 15](../architecture/decisions/0015-use-django-fs.md) for more information on the topic. + +## Login Time Bug + +If you are seeing errors related to openid complaining about issuing a token from the future like this: + +``` +ERROR [djangooidc.oidc:243] Issued in the future +``` + +it may help to resync your laptop with time.nist.gov: + +``` +sudo sntp -sS time.nist.gov +```