diff --git a/src/registrar/registrar_middleware.py b/src/registrar/registrar_middleware.py index 5707c4d5d..f93f5bf51 100644 --- a/src/registrar/registrar_middleware.py +++ b/src/registrar/registrar_middleware.py @@ -36,6 +36,16 @@ class CheckUserProfileMiddleware: # Check if setup is not finished finished_setup = hasattr(request.user, "finished_setup") and request.user.finished_setup + if hasattr(request.user, "finished_setup"): + user_values = [ + request.user.contact.first_name, + request.user.contact.last_name, + request.user.contact.title, + request.user.contact.phone + ] + if None in user_values: + finished_setup = False + if request.user.is_authenticated and not finished_setup: return self._handle_setup_not_finished(request) diff --git a/src/registrar/templates/finish_profile_setup.html b/src/registrar/templates/finish_profile_setup.html index bfce64c90..ae4b8a3c5 100644 --- a/src/registrar/templates/finish_profile_setup.html +++ b/src/registrar/templates/finish_profile_setup.html @@ -1,4 +1,5 @@ -{% extends "base.html" %} +{% extends "profile.html" %} + {% load static form_helpers url_helpers field_helpers %} {% block title %} Finish setting up your profile | {% endblock %} @@ -12,111 +13,35 @@
- - {% comment %} - Form success messages. - {% endcomment %} + {# messages block is under the back breadcrumb link #} {% if messages %} - {% for message in messages %} -
-
- {{ message }} -
-
- {% endfor %} - {% endif %} - - {% comment %} - Repurposed from domain_request_form.html. - Form errors. - {% endcomment %} - {% include "includes/form_errors.html" with form=form %} - {% for outer in forms %} - {% if outer|isformset %} - {% for inner in outer.forms %} - {% include "includes/form_errors.html" with form=inner %} - {% endfor %} - {% else %} - {% include "includes/form_errors.html" with form=outer %} - {% endif %} - {% endfor %} - -

Finish setting up your profile

- -

- We require - that you maintain accurate contact information. - The details you provide will only be used to support the administration of .gov and won’t be made public. -

- -

What contact information should we use to reach you?

-

- Review the details below and update any required information. - Note that editing this information won’t affect your Login.gov account information. -

- {# We use a var called 'remove_margin_top' rather than 'add_margin_top' because most fields use this #} - {% include "includes/required_fields.html" with remove_margin_top=True %} -
- {% csrf_token %} -
- - Your contact information - - - {% with show_edit_button=True show_readonly=True group_classes="usa-form-readonly usa-form-readonly--no-border padding-top-2" %} - {% input_with_errors form.full_name %} - {% endwith %} - - - - {# This field doesn't have the readonly button but it has common design elements from it #} - {% with show_readonly=True group_classes="usa-form-readonly padding-top-2 bold-usa-label" %} - {% with target_blank="true" sublabel_text=email_sublabel_text add_class="display-none" %} - {% input_with_errors form.email %} - {% endwith %} - {% endwith %} - - {% with show_edit_button=True show_readonly=True group_classes="usa-form-readonly padding-top-2" %} - {% input_with_errors form.title %} - {% endwith %} - - {% with show_edit_button=True show_readonly=True group_classes="usa-form-readonly padding-top-2" %} - {% with add_class="usa-input--medium" %} - {% input_with_errors form.phone %} - {% endwith %} - {% endwith %} - -
-
- - {% if confirm_changes %} - - {% else %} - - {% endif %} + {% for message in messages %} +
+
+ {{ message }}
- {% block form_fields %}{% endblock %} +
+ {% endfor %} + {% endif %} + {% include "includes/form_errors.html" with form=form %} + + {% if confirm_changes and not going_to_specific_page %} + + + +

+ Back to manage your domains +

+
+ {% endif %} + + {% include "includes/finish_profile_form.html" with form=form %}
- {% endblock content %} {% block footer %} diff --git a/src/registrar/templates/includes/finish_profile_form.html b/src/registrar/templates/includes/finish_profile_form.html new file mode 100644 index 000000000..c30345565 --- /dev/null +++ b/src/registrar/templates/includes/finish_profile_form.html @@ -0,0 +1,85 @@ +{% extends 'includes/profile_form.html' %} + +{% load static url_helpers %} +{% load field_helpers %} + +{% block profile_header %} +

Finish setting up your profile

+{% endblock profile_header %} + +{% block profile_blurb %} +

+ We require + that you maintain accurate contact information. + The details you provide will only be used to support the administration of .gov and won’t be made public. +

+ +

What contact information should we use to reach you?

+

+ Review the details below and update any required information. + Note that editing this information won’t affect your Login.gov account information. +

+ +{# We use a var called 'remove_margin_top' rather than 'add_margin_top' because most fields use this #} +{% include "includes/required_fields.html" with remove_margin_top=True %} + +{% endblock profile_blurb %} + +{% block profile_form %} + + {% csrf_token %} +
+ + Your contact information + + + {% with show_edit_button=True show_readonly=True group_classes="usa-form-readonly usa-form-readonly--no-border padding-top-2" %} + {% input_with_errors form.full_name %} + {% endwith %} + + + + {# This field doesn't have the readonly button but it has common design elements from it #} + {% with show_readonly=True group_classes="usa-form-readonly padding-top-2 bold-usa-label" %} + {% with target_blank="true" sublabel_text=email_sublabel_text add_class="display-none" %} + {% input_with_errors form.email %} + {% endwith %} + {% endwith %} + + {% with show_edit_button=True show_readonly=True group_classes="usa-form-readonly padding-top-2" %} + {% input_with_errors form.title %} + {% endwith %} + + {% with show_edit_button=True show_readonly=True group_classes="usa-form-readonly padding-top-2" %} + {% with add_class="usa-input--medium" %} + {% input_with_errors form.phone %} + {% endwith %} + {% endwith %} + +
+
+ + + {% if confirm_changes and going_to_specific_page %} + + {% endif %} +
+ + +{% endblock profile_form %} \ No newline at end of file diff --git a/src/registrar/templates/includes/profile_form.html b/src/registrar/templates/includes/profile_form.html new file mode 100644 index 000000000..378bb66a4 --- /dev/null +++ b/src/registrar/templates/includes/profile_form.html @@ -0,0 +1,51 @@ +{% load static url_helpers %} +{% load field_helpers %} + +{% block profile_header %} +

Your profile

+{% endblock profile_header %} + +{% block profile_blurb %} +

We require that you maintain accurate contact information. The details you provide will only be used to support the administration of .gov and won’t be made public.

+ +

Contact information

+

Review the details below and update any required information. Note that editing this information won’t affect your Login.gov account information.

+{% include "includes/required_fields.html" %} +{% endblock profile_blurb %} + + +{% block profile_form %} +
+ {% csrf_token %} +
+ + {% input_with_errors form.first_name %} + + {% input_with_errors form.middle_name %} + + {% input_with_errors form.last_name %} + + {% input_with_errors form.title %} + + {% public_site_url "help/account-management/#get-help-with-login.gov" as login_help_url %} + + {% with link_href=login_help_url %} + {% with sublabel_text="We recommend using your work email for your .gov account. If the wrong email is displayed below, you’ll need to update your Login.gov account and log back in. Get help with your Login.gov account." %} + {% with link_text="Get help with your Login.gov account" %} + {% with target_blank=True %} + {% with do_not_show_max_chars=True %} + {% input_with_errors form.email %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endwith %} + + {% with add_class="usa-input--medium" %} + {% input_with_errors form.phone %} + {% endwith %} + +
+ +
+{% endblock profile_form %} \ No newline at end of file diff --git a/src/registrar/templates/profile.html b/src/registrar/templates/profile.html index 70081698c..ddee8483e 100644 --- a/src/registrar/templates/profile.html +++ b/src/registrar/templates/profile.html @@ -1,11 +1,9 @@ {% extends 'base.html' %} - {% block title %} Edit your User Profile | {% endblock title %} {% load static url_helpers %} -{% load field_helpers %} {% block content %}
@@ -16,7 +14,7 @@ Edit your User Profile |

- Back to manage your domains + Go to manage your domains

{# messages block is under the back breadcrumb link #} @@ -30,48 +28,7 @@ Edit your User Profile | {% endfor %} {% endif %} {% include "includes/form_errors.html" with form=form %} - -

Your profile

-

We require that you maintain accurate contact information. The details you provide will only be used to support the administration of .gov and won’t be made public.

- -

Contact information

-

Review the details below and update any required information. Note that editing this information won’t affect your Login.gov account information.

- - {% include "includes/required_fields.html" %} - -
- {% csrf_token %} -
- - {% input_with_errors form.first_name %} - - {% input_with_errors form.middle_name %} - - {% input_with_errors form.last_name %} - - {% input_with_errors form.title %} - - {% public_site_url "help/account-management/#get-help-with-login.gov" as login_help_url %} - - {% with link_href=login_help_url %} - {% with sublabel_text="We recommend using your work email for your .gov account. If the wrong email is displayed below, you’ll need to update your Login.gov account and log back in. Get help with your Login.gov account." %} - {% with link_text="Get help with your Login.gov account" %} - {% with target_blank=True %} - {% with do_not_show_max_chars=True %} - {% input_with_errors form.email %} - {% endwith %} - {% endwith %} - {% endwith %} - {% endwith %} - {% endwith %} - - {% with add_class="usa-input--medium" %} - {% input_with_errors form.phone %} - {% endwith %} - -
- -
+ {% include "includes/profile_form.html" with form=form %} +
{% endblock content %} - diff --git a/src/registrar/views/user_profile.py b/src/registrar/views/user_profile.py index b22f1c80e..9147360d2 100644 --- a/src/registrar/views/user_profile.py +++ b/src/registrar/views/user_profile.py @@ -123,6 +123,10 @@ class FinishProfileSetupView(UserProfileView): if self.redirect_type == self.RedirectType.COMPLETE_SETUP: context["confirm_changes"] = True + + if "redirect_viewname" in self.session: + context["going_to_specific_page"] = True + context["redirect_button_text"] = "Continue to your request" return context