flows: save entire GET params from shell executor

This commit is contained in:
Jens Langhammer 2020-06-21 20:46:38 +02:00
parent 39f51ec33d
commit de1be2df88
3 changed files with 8 additions and 9 deletions

View File

@ -222,7 +222,9 @@ class TestProviderOIDC(SeleniumTestCase):
self.driver.find_element(By.CSS_SELECTOR, "[type=submit]").click()
self.wait.until(
ec.presence_of_element_located((By.XPATH, "//a[contains(@href, '/profile')]"))
ec.presence_of_element_located(
(By.XPATH, "//a[contains(@href, '/profile')]")
)
)
self.driver.find_element(By.XPATH, "//a[contains(@href, '/profile')]").click()
self.assertEqual(

View File

@ -1,10 +1,10 @@
"""passbook e2e testing utilities"""
from time import time
from functools import lru_cache
from glob import glob
from importlib.util import module_from_spec, spec_from_file_location
from inspect import getmembers, isfunction
from os import makedirs
from time import time
from Cryptodome.PublicKey import RSA
from django.apps import apps

View File

@ -27,7 +27,7 @@ LOGGER = get_logger()
# Argument used to redirect user after login
NEXT_ARG_NAME = "next"
SESSION_KEY_PLAN = "passbook_flows_plan"
SESSION_KEY_NEXT = "passbook_flows_shell_next"
SESSION_KEY_GET = "passbook_flows_get"
@method_decorator(xframe_options_sameorigin, name="dispatch")
@ -129,8 +129,8 @@ class FlowExecutorView(View):
"""User Successfully passed all stages"""
self.cancel()
# Since this is wrapped by the ExecutorShell, the next argument is saved in the session
next_param = self.request.session.get(
SESSION_KEY_NEXT, "passbook_core:overview"
next_param = self.request.session.get(SESSION_KEY_GET, {}).get(
NEXT_ARG_NAME, "passbook_core:overview"
)
return redirect_with_qs(next_param)
@ -214,10 +214,7 @@ class FlowExecutorShellView(TemplateView):
def get_context_data(self, **kwargs) -> Dict[str, Any]:
kwargs["exec_url"] = reverse("passbook_flows:flow-executor", kwargs=self.kwargs)
kwargs["msg_url"] = reverse("passbook_api:messages-list")
if NEXT_ARG_NAME in self.request.GET:
next_arg = self.request.GET[NEXT_ARG_NAME]
LOGGER.debug("f(exec/shell): Saved next param", next=next_arg)
self.request.session[SESSION_KEY_NEXT] = next_arg
self.request.session[SESSION_KEY_GET] = self.request.GET
return kwargs