remove the dnssec confirmed session

This commit is contained in:
Rachid Mrad 2023-10-23 16:43:45 -04:00
parent ffbae457bf
commit 8bf2432b15
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF
2 changed files with 6 additions and 17 deletions

View file

@ -22,7 +22,7 @@
<p>Enter the values given by your DNS provider for DS Data.</p> <p>Enter the values given by your DNS provider for DS Data.</p>
{% if not dnssec_ds_confirmed %} {% comment %} {% if not dnssec_ds_confirmed %}
<p>Required fields are marked with an asterisk (<abbr <p>Required fields are marked with an asterisk (<abbr
title="required" title="required"
class="usa-hint usa-hint--required" class="usa-hint usa-hint--required"
@ -35,7 +35,7 @@
</svg><span class="margin-left-05">Add new record</span> </svg><span class="margin-left-05">Add new record</span>
</button> </button>
</form> </form>
{% else %} {% else %} {% endcomment %}
{% include "includes/required_fields.html" %} {% include "includes/required_fields.html" %}
<form class="usa-form usa-form--extra-large" method="post" novalidate id="form-container"> <form class="usa-form usa-form--extra-large" method="post" novalidate id="form-container">
@ -111,7 +111,7 @@
>Cancel >Cancel
</button> </button>
</form> </form>
{% endif %} {% comment %} {% endif %} {% endcomment %}
{% if trigger_modal %} {% if trigger_modal %}
<a <a

View file

@ -333,9 +333,6 @@ class DomainDsDataView(DomainPermissionView, FormMixin):
# context to back out of a broken form on all fields delete # context to back out of a broken form on all fields delete
context["modal_button"] = modal_button context["modal_button"] = modal_button
context["dnssec_ds_confirmed"] = self.request.session.get(
"dnssec_ds_confirmed", False
)
return context return context
@ -344,23 +341,15 @@ class DomainDsDataView(DomainPermissionView, FormMixin):
self.object = self.get_object() self.object = self.get_object()
formset = self.get_form() formset = self.get_form()
override = False override = False
# switch to form in template
if "confirm-ds" in request.POST:
request.session["dnssec_ds_confirmed"] = True
return super().form_valid(formset)
# This is called but the form cancel button, but also by the modal's X and cacel button # This is called by the form cancel button, and also by the modal's X and cancel buttons
if "btn-cancel-click" in request.POST: if "btn-cancel-click" in request.POST:
return render(request, 'domain_dsdata.html', {'formset': formset}) return redirect("domain-dns-dnssec-dsdata", {"formset": formset}, RequestContext(request))
if "disable-override-click" in request.POST: if "disable-override-click" in request.POST:
override = True override = True
# we are deleteing all data,
# switch out of form
request.session["dnssec_ds_confirmed"] = False
if len(formset) == 0 and formset.initial != [{}] and override == False: if len(formset) == 0 and formset.initial == [{}] and override == False:
# trigger the modal # trigger the modal
context = self.get_context_data(**kwargs) context = self.get_context_data(**kwargs)
context["trigger_modal"] = True context["trigger_modal"] = True