From dbd418dc48cd9caa8e8621a75727203b08de8199 Mon Sep 17 00:00:00 2001 From: Rachid Mrad Date: Fri, 14 Jun 2024 13:53:33 -0400 Subject: [PATCH] cleanup --- src/registrar/forms/user_profile.py | 2 +- src/registrar/registrar_middleware.py | 7 +++---- src/registrar/templates/profile.html | 12 +++++++++++- src/registrar/views/user_profile.py | 7 ++++++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/registrar/forms/user_profile.py b/src/registrar/forms/user_profile.py index 557e34e0d..3dd8cbdce 100644 --- a/src/registrar/forms/user_profile.py +++ b/src/registrar/forms/user_profile.py @@ -47,7 +47,7 @@ class UserProfileForm(forms.ModelForm): self.fields["middle_name"].label = "Middle name (optional)" self.fields["last_name"].label = "Last name / family name" self.fields["title"].label = "Title or role in your organization" - self.fields["email"].label = "Organizational email" + self.fields["email"].label = "Organization email" # Set custom error messages self.fields["first_name"].error_messages = {"required": "Enter your first name / given name."} diff --git a/src/registrar/registrar_middleware.py b/src/registrar/registrar_middleware.py index 5e1abeb9b..79e3b7a11 100644 --- a/src/registrar/registrar_middleware.py +++ b/src/registrar/registrar_middleware.py @@ -68,11 +68,10 @@ class CheckUserProfileMiddleware: return None if request.user.is_authenticated: - if request.user.verification_type == User.VerificationTypeChoices.REGULAR: - if hasattr(request.user, "finished_setup") and not request.user.finished_setup: + if hasattr(request.user, "finished_setup") and not request.user.finished_setup: + if request.user.verification_type == User.VerificationTypeChoices.REGULAR: return self._handle_regular_user_setup_not_finished(request) - else: - if hasattr(request.user, "finished_setup") and not request.user.finished_setup: + else: return self._handle_other_user_setup_not_finished(request) # Continue processing the view diff --git a/src/registrar/templates/profile.html b/src/registrar/templates/profile.html index 16b7e2688..dd371b930 100644 --- a/src/registrar/templates/profile.html +++ b/src/registrar/templates/profile.html @@ -49,7 +49,7 @@ Edit your User Profile | data-open-modal >Open confirmation modal
+ {% endif %} diff --git a/src/registrar/views/user_profile.py b/src/registrar/views/user_profile.py index 785ac1528..f148f5652 100644 --- a/src/registrar/views/user_profile.py +++ b/src/registrar/views/user_profile.py @@ -15,6 +15,7 @@ from django.urls import NoReverseMatch, reverse from registrar.models import ( Contact, ) +from registrar.models.user import User from registrar.models.utility.generic_helper import replace_url_queryparams from registrar.views.utility.permission_views import UserProfilePermissionView from waffle.decorators import flag_is_active, waffle_flag @@ -41,7 +42,11 @@ class UserProfileView(UserProfilePermissionView, FormMixin): form = self.form_class(instance=self.object) context = self.get_context_data(object=self.object, form=form) - if hasattr(self.user, "finished_setup") and not self.user.finished_setup: + if ( + hasattr(self.user, "finished_setup") + and not self.user.finished_setup + and self.user.verification_type != User.VerificationTypeChoices.REGULAR + ): context["show_confirmation_modal"] = True return_to_request = request.GET.get("return_to_request")