Merge branch 'main' into nmb/organization-type

This commit is contained in:
Neil Martinsen-Burrell 2022-11-23 13:29:05 -06:00
commit fd687b8e3b
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
5 changed files with 73 additions and 11 deletions

View file

@ -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
```

View file

@ -7,7 +7,7 @@
{% block content %}
<main id="main-content" class="grid-container">
<h2>{% translate "Page not found" %}</h2>
<h1>{% translate "Page not found" %}</h1>
<p>{% translate "The requested page could not be found." %}</p>

View file

@ -6,21 +6,51 @@
<section class="usa-hero">
<div class="usa-grid">
<div class="usa-hero-callout usa-section-dark">
<h2>
<h1>
<span class="usa-hero-callout-alt">Welcome to the .gov registrar</span>
</h2>
</h1>
</div>
</section>
{% endblock %}
{% block content %}
<main id="main-content" class="grid-container">
<p>This is the .gov registrar.</p>
<p>This is the .gov registrar.</p>
{% if user.is_authenticated %}
<p><a href="/openid/logout/">Click here to log out.</a></p>
{% else %}
<p><a href="/openid/login/">Click here to log in.</a></p>
{% endif %}
{% if user.is_authenticated %}
{% if domain_applications %}
<h2>Your domain applications</h2>
<table class="usa-table usa-table--borderless">
<caption class="sr-only">Your domain applications</caption>
<thead>
<tr>
<th>Name</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for application in domain_applications %}
<tr>
<th>{{ application.requested_domain.website }}</th>
<td>{{ application.status }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<p><a href="{% url 'application' %}" class="usa-button">Apply</a></p>
<p><a href="{% url 'edit-profile' %}">Edit profile</a></p>
{% if user.is_staff %}
<p><a href="{% url 'admin:index' %}">CISA admin panel</a></p>
{% endif %}
<p><a href="{% url 'logout' %}">Click here to log out.</a></p>
{% else %}
<p><a href="{% url 'login' %}">Click here to log in.</a></p>
{% endif %}
</main>
{% endblock %}

View file

@ -5,7 +5,7 @@ from django.contrib.auth import get_user_model
from django_webtest import WebTest # type: ignore
from registrar.models import DomainApplication
from registrar.models import DomainApplication, Website
from registrar.forms.application_wizard import TITLES
@ -55,6 +55,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/")

View file

@ -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)