Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add the session checking functionality #49

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 23 additions & 24 deletions request_a_govuk_domain/request/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,27 @@ def is_valid_start_path(self, path: str):
return False

def is_valid_progress(self, request):
if request.session.get("registration_data") is None:
return False
for key in request.session.get("registration_data"):
if key not in [
"applicant_email",
"applicant_name",
"applicant_phone",
"domain_name",
"domain_purpose",
"registrant_contact_email",
"registrant_contact_phone",
"registrant_email_address",
"registrant_full_name",
"registrant_organisation_name",
"registrant_phone",
"registrant_role",
"registrant_type",
"registrar_organisation",
"written_permission",
]:
# A key in the session data is unknown. So go back to the beginning
request.session["registration_data"] = {}
return False
return True
# if request.session.get("registration_data") is None:
# return False
# for key in request.session.get("registration_data"):
# if key not in [
# "applicant_email",
# "applicant_name",
# "applicant_phone",
# "domain_name",
# "domain_purpose",
# "registrant_contact_email",
# "registrant_contact_phone",
# "registrant_email_address",
# "registrant_full_name",
# "registrant_organisation_name",
# "registrant_phone",
# "registrant_role",
# "registrant_type",
# "registrar_organisation",
# "written_permission",
# ]:
# # A key in the session data is invalid. So go back to the beginning
# request.session["registration_data"] = {}
# return False
# return True