def realm_redirect(request: HttpRequest) -> HttpResponse: if request.method == 'POST': form = RealmRedirectForm(request.POST) if form.is_valid(): subdomain = form.cleaned_data['subdomain'] realm = get_realm(subdomain) redirect_to = get_safe_redirect_to(request.GET.get("next", ""), realm.uri) return HttpResponseRedirect(redirect_to) else: form = RealmRedirectForm() return render(request, 'zerver/realm_redirect.html', context={'form': form})
def realm_redirect(request: HttpRequest, next: str = REQ(default="")) -> HttpResponse: if request.method == "POST": form = RealmRedirectForm(request.POST) if form.is_valid(): subdomain = form.cleaned_data["subdomain"] realm = get_realm(subdomain) redirect_to = get_safe_redirect_to(next, realm.uri) return HttpResponseRedirect(redirect_to) else: form = RealmRedirectForm() return render(request, "zerver/realm_redirect.html", context={"form": form})
def realm_redirect(request: HttpRequest) -> HttpResponse: if request.method == 'POST': form = RealmRedirectForm(request.POST) if form.is_valid(): subdomain = form.cleaned_data['subdomain'] realm = get_realm(subdomain) redirect_to = get_safe_redirect_to(request.GET.get("next", ""), realm.uri) return HttpResponseRedirect(redirect_to) else: form = RealmRedirectForm() return render(request, 'zerver/realm_redirect.html', context={'form': form})