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

active_group switch handles invalid group #273

Merged
merged 2 commits into from
Mar 24, 2021
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
8 changes: 6 additions & 2 deletions omeroweb/webclient/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,9 @@ def change_active_group(request, conn=None, url=None, **kwargs):
Finally this redirects to the 'url'.
"""
switch_active_group(request)
url = url or reverse("webindex")
# avoid recursive calls
if url is None or url.startswith(reverse("change_active_group")):
url = reverse("webindex")
url = validate_redirect_url(url)
return HttpResponseRedirect(url)

Expand All @@ -360,7 +362,9 @@ def switch_active_group(request, active_group=None):
queries.
"""
if active_group is None:
active_group = request.GET.get("active_group")
active_group = get_long_or_default(request, "active_group", None)
if active_group is None:
return
active_group = int(active_group)
if (
"active_group" not in request.session
Expand Down