Fix issues from merge

This commit is contained in:
Neil Martinsen-Burrell 2023-01-09 14:03:00 -06:00
parent 8d3991614e
commit dc7c782050
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
5 changed files with 45 additions and 32 deletions

View file

@ -446,3 +446,14 @@ class RequirementsForm(RegistrarForm):
), ),
required=False, # use field validation to enforce this required=False, # use field validation to enforce this
) )
def clean_is_policy_acknowledged(self):
"""This box must be checked to proceed but offer a clear error."""
# already converted to a boolean
is_acknowledged = self.cleaned_data["is_policy_acknowledged"]
if not is_acknowledged:
raise forms.ValidationError(
"You must read and agree to the .gov domain requirements to proceed.",
code="invalid",
)
return is_acknowledged

View file

@ -8,7 +8,7 @@
<form class="usa-form usa-form--large" id="step__{{steps.current}}" method="post"> <form class="usa-form usa-form--large" id="step__{{steps.current}}" method="post">
{% csrf_token %} {% csrf_token %}
{% input_with_errors forms.0.form.current_site %} {% input_with_errors forms.0.current_site %}
{{ block.super }} {{ block.super }}

View file

@ -28,23 +28,23 @@
<p> This question is required. </p> <p> This question is required. </p>
{% csrf_token %} {% csrf_token %}
{% if wizard.form.requested_domain.errors %} {% if forms.0.requested_domain.errors %}
<div class="usa-form-group usa-form-group--error"> <div class="usa-form-group usa-form-group--error">
{% for error in wizard.form.requested_domain.errors %} {% for error in forms.0.requested_domain.errors %}
<span class="usa-error-message" id="input-error-message" role="alert"> <span class="usa-error-message" id="input-error-message" role="alert">
{{ error }} {{ error }}
</span> </span>
{% endfor %} {% endfor %}
<div class="display-flex flex-align-center"> <div class="display-flex flex-align-center">
<span class="padding-top-05 padding-right-2px">www.</span> <span class="padding-top-05 padding-right-2px">www.</span>
{{ wizard.form.requested_domain|add_class:"usa-input usa-input--error"|attr:"aria-describedby:domain_instructions"|attr:"aria-invalid:true" }} {{ forms.0.requested_domain|add_class:"usa-input usa-input--error"|attr:"aria-describedby:domain_instructions"|attr:"aria-invalid:true" }}
<span class="padding-top-05 padding-left-2px">.gov </span> <span class="padding-top-05 padding-left-2px">.gov </span>
</div> </div>
</div> </div>
{% else %} {% else %}
<div class="display-flex flex-align-center"> <div class="display-flex flex-align-center">
<span class="padding-top-05 padding-right-2px">www.</span> <span class="padding-top-05 padding-right-2px">www.</span>
{{ wizard.form.requested_domain|add_class:"usa-input"|attr:"aria-describedby:domain_instructions" }} {{ forms.0.requested_domain|add_class:"usa-input"|attr:"aria-describedby:domain_instructions" }}
<span class="padding-top-05 padding-left-2px">.gov </span> <span class="padding-top-05 padding-left-2px">.gov </span>
</div> </div>
{% endif %} {% endif %}
@ -53,25 +53,25 @@
<h2>Alternative domains</h2> <h2>Alternative domains</h2>
<div> <div>
{% if wizard.form.alternative_domain.errors %} {% if forms.0.alternative_domain.errors %}
<div class="usa-form-group usa-form-group--error"> <div class="usa-form-group usa-form-group--error">
{{ wizard.form.alternative_domain|add_label_class:"usa-label usa-label--error" }} {{ forms.0.alternative_domain|add_label_class:"usa-label usa-label--error" }}
{% for error in wizard.for.alternative_domain.errors %} {% for error in forms.0.alternative_domain.errors %}
<span class="usa-error-message" id="input-error-message" role="alert"> <span class="usa-error-message" id="input-error-message" role="alert">
{{ error }} {{ error }}
</span> </span>
{% endfor %} {% endfor %}
<div class="display-flex flex-align-center"> <div class="display-flex flex-align-center">
<span class="padding-top-05 padding-right-2px">www.</span> <span class="padding-top-05 padding-right-2px">www.</span>
{{ wizard.form.alternative_domain|add_class:"usa-input usa-input--error"|attr:"aria-describedby:domain_instructions"|attr:"aria-invalid:true" }} { forms.0.alternative_domain|add_class:"usa-input usa-input--error"|attr:"aria-describedby:domain_instructions"|attr:"aria-invalid:true" }}
<span class="padding-top-05 padding-left-2px">.gov </span> <span class="padding-top-05 padding-left-2px">.gov </span>
</div> </div>
</div> </div>
{% else %} {% else %}
{{ wizard.form.alternative_domain|add_label_class:"usa-label" }} {{ forms.0.alternative_domain|add_label_class:"usa-label" }}
<div class="display-flex flex-align-center"> <div class="display-flex flex-align-center">
<span class="padding-top-05 padding-right-2px">www.</span> <span class="padding-top-05 padding-right-2px">www.</span>
{{ wizard.form.alternative_domain|add_class:"usa-input"|attr:"aria-describedby:domain_instructions" }} {{ forms.0.alternative_domain|add_class:"usa-input"|attr:"aria-describedby:domain_instructions" }}
<span class="padding-top-05 padding-left-2px">.gov </span> <span class="padding-top-05 padding-left-2px">.gov </span>
</div> </div>
{% endif %} {% endif %}

View file

@ -18,6 +18,7 @@
</a> </a>
{% endif %} {% endif %}
{% for form in forms %}
{% if form.errors %} {% if form.errors %}
{% for error in form.non_field_errors %} {% for error in form.non_field_errors %}
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2"> <div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
@ -36,6 +37,7 @@
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %}
<h1> {{form_titles|get_item:steps.current}} </h1> <h1> {{form_titles|get_item:steps.current}} </h1>
{% block form_content %} {% block form_content %}

View file

@ -10,19 +10,19 @@
<form class="usa-form usa-form--large" id="step__{{steps.current}}" method="post" novalidate> <form class="usa-form usa-form--large" id="step__{{steps.current}}" method="post" novalidate>
{% csrf_token %} {% csrf_token %}
{% if wizard.form.security_email.errors %} {% if forms.0.security_email.errors %}
<div class="usa-form-group usa-form-group--error"> <div class="usa-form-group usa-form-group--error">
{{ wizard.form.security_email|add_label_class:"usa-label usa-label--error" }} {{ forms.0.security_email|add_label_class:"usa-label usa-label--error" }}
{% for error in wizard.form.security_email.errors %} {% for error in forms.0.security_email.errors %}
<span class="usa-error-message" id="input-error-message" role="alert"> <span class="usa-error-message" id="input-error-message" role="alert">
{{ error }} {{ error }}
</span> </span>
{% endfor %} {% endfor %}
{{ wizard.form.security_email|add_class:"usa-input"|add_class:"usa-input--error"|attr:"aria-describedby:instructions"|attr:"aria-invalid:true" }} {{ forms.0.security_email|add_class:"usa-input"|add_class:"usa-input--error"|attr:"aria-describedby:instructions"|attr:"aria-invalid:true" }}
</div> </div>
{% else %} {% else %}
{{ wizard.form.security_email|add_label_class:"usa-label" }} {{ forms.0.security_email|add_label_class:"usa-label" }}
{{ wizard.form.security_email|add_class:"usa-input"|attr:"aria-describedby:instructions" }} {{ forms.0.security_email|add_class:"usa-input"|attr:"aria-describedby:instructions" }}
{% endif %} {% endif %}
{{ block.super }} {{ block.super }}