Merge branch 'main' into nmb/user-invitations

This commit is contained in:
Neil Martinsen-Burrell 2023-03-23 14:49:04 -05:00
commit c12aa1dd75
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
5 changed files with 53 additions and 26 deletions

View file

@ -1 +1,2 @@
from .application_wizard import *
from .domain import DomainAddUserForm

View file

@ -0,0 +1,21 @@
"""Forms for domain management."""
from django import forms
from registrar.models import User
class DomainAddUserForm(forms.Form):
"""Form for adding a user to a domain."""
email = forms.EmailField(label="Email")
def clean_email(self):
requested_email = self.cleaned_data["email"]
try:
User.objects.get(email=requested_email)
except User.DoesNotExist:
# TODO: send an invitation email to a non-existent user
raise forms.ValidationError("That user does not exist in this system.")
return requested_email

View file

@ -14,12 +14,18 @@ from .utility import DomainPermission
class DomainView(DomainPermission, DetailView):
"""Domain detail overview page."""
model = Domain
template_name = "domain_detail.html"
context_object_name = "domain"
class DomainUsersView(DomainPermission, DetailView):
"""User management page in the domain details."""
model = Domain
template_name = "domain_users.html"
context_object_name = "domain"
@ -33,6 +39,13 @@ class DomainAddUserForm(DomainPermission, forms.Form):
class DomainAddUserView(DomainPermission, FormMixin, DetailView):
"""Inside of a domain's user management, a form for adding users.
Multiple inheritance is used here for permissions, form handling, and
details of the individual domain.
"""
template_name = "domain_add_user.html"
model = Domain
form_class = DomainAddUserForm

View file

@ -49,6 +49,8 @@
10038 OUTOFSCOPE http://app:8080/public/css/.*
10038 OUTOFSCOPE http://app:8080/public/js/.*
10038 OUTOFSCOPE http://app:8080/(robots.txt|sitemap.xml|TODO|edit/)
10038 OUTOFSCOPE http://app:8080/users
10038 OUTOFSCOPE http://app:8080/users/add
# This URL always returns 404, so include it as well.
10038 OUTOFSCOPE http://app:8080/todo
# OIDC isn't configured in the test environment and DEBUG=True so this gives a 500 without CSP headers