mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-03 08:22:18 +02:00
form not logged in
This commit is contained in:
parent
6532db84c6
commit
fbf6430b5f
4 changed files with 6 additions and 29 deletions
|
@ -7,6 +7,7 @@
|
|||
"http://localhost:8080/",
|
||||
"http://localhost:8080/health/",
|
||||
"http://localhost:8080/request/",
|
||||
"http://localhost:8080/request/start",
|
||||
"http://localhost:8080/request/organization/",
|
||||
"http://localhost:8080/request/org_federal/",
|
||||
"http://localhost:8080/request/org_election/",
|
||||
|
|
|
@ -2820,28 +2820,3 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
// Add event listener to the suborg dropdown to show/hide the suborg details section
|
||||
select.addEventListener("change", () => toggleSuborganization());
|
||||
})();
|
||||
|
||||
|
||||
(function handleDomainRequestIntro() {
|
||||
const domainRequestId = document.getElementById("wizard-domain-request-id")?.value;
|
||||
|
||||
// Handle back button navigation and initial page load
|
||||
function handleStartPage(event) {
|
||||
if (window.location.pathname === "/request/start/") {
|
||||
if (event && !event.persisted) return;
|
||||
const domainRequestId = sessionStorage.getItem("domainRequestId");
|
||||
console.log("Domain request ID retrieved:", domainRequestId);
|
||||
}
|
||||
}
|
||||
|
||||
if (domainRequestId) {
|
||||
sessionStorage.setItem("domainRequestId", domainRequestId);
|
||||
console.log("Domain request ID stored:", domainRequestId);
|
||||
}
|
||||
|
||||
// Listen for back/forward navigation
|
||||
window.addEventListener('pageshow', handleStartPage);
|
||||
|
||||
// Handle initial page load
|
||||
handleStartPage();
|
||||
})();
|
||||
|
|
|
@ -92,7 +92,7 @@ class CheckUserProfileMiddleware:
|
|||
|
||||
We set the "redirect" query param equal to where the user wants to go.
|
||||
|
||||
If the user wants to go to '/request/', then we set that
|
||||
If the user wants to go to '/request/start/' or '/request/', then we set that
|
||||
information in the query param.
|
||||
|
||||
Otherwise, we assume they want to go to the home page.
|
||||
|
@ -100,7 +100,8 @@ class CheckUserProfileMiddleware:
|
|||
|
||||
# In some cases, we don't want to redirect to home. This handles that.
|
||||
# Can easily be generalized if need be, but for now lets keep this easy to read.
|
||||
custom_redirect = "domain-request:start" if request.path == "/request/" else None
|
||||
start_paths = ["/request/", "/request/start/"]
|
||||
custom_redirect = "domain-request:start" if request.path in start_paths else None
|
||||
|
||||
# Don't redirect on excluded pages (such as the setup page itself)
|
||||
if not any(request.path.startswith(page) for page in self._get_excluded_pages(profile_page)):
|
||||
|
|
|
@ -49,9 +49,9 @@ class TestViews(TestCase):
|
|||
@less_console_noise_decorator
|
||||
def test_domain_request_form_not_logged_in(self):
|
||||
"""Domain request form not accessible without a logged-in user."""
|
||||
response = self.client.get("/request/")
|
||||
response = self.client.get(reverse("domain-request:start"))
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertIn("/login?next=/request/", response.headers["Location"])
|
||||
self.assertIn("/login?next=/request/start/", response.headers["Location"])
|
||||
|
||||
|
||||
class TestWithUser(MockEppLib):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue