diff --git a/src/pretix/static/pretixpresale/js/widget/widget.js b/src/pretix/static/pretixpresale/js/widget/widget.js index 3857b1b85b..ce984b5ab0 100644 --- a/src/pretix/static/pretixpresale/js/widget/widget.js +++ b/src/pretix/static/pretixpresale/js/widget/widget.js @@ -765,41 +765,11 @@ var shared_methods = { redeem: function (event) { if (this.$root.useIframe) { event.preventDefault(); - } else { - if (this.$root.additionalURLParams) { - var params = new URLSearchParams(this.$root.additionalURLParams); - for (var [key, value] of params.entries()) { - if (!event.target.form.elements[key]) { - var input = document.createElement("input"); - input.type = "hidden"; - input.name = key; - input.value = value; - event.target.form.appendChild(input); - } - } - } - return; + this.voucher_open(this.voucher); } - var redirect_url = this.$root.voucherFormTarget + '&voucher=' + encodeURIComponent(this.voucher) + '&subevent=' + this.$root.subevent; - if (this.$root.widget_data) { - redirect_url += '&widget_data=' + encodeURIComponent(this.$root.widget_data_json); - } - if (this.$root.additionalURLParams) { - redirect_url += '&' + this.$root.additionalURLParams; - } - redirect_url += this.$root.consent_parameter; - this.$root.overlay.frame_src = redirect_url; }, voucher_open: function (voucher) { - var redirect_url; - redirect_url = this.$root.voucherFormTarget + '&voucher=' + encodeURIComponent(voucher); - if (this.$root.widget_data) { - redirect_url += '&widget_data=' + encodeURIComponent(this.$root.widget_data_json); - } - if (this.$root.additionalURLParams) { - redirect_url += '&' + this.$root.additionalURLParams; - } - redirect_url += this.$root.consent_parameter; + var redirect_url = this.$root.voucherFormTarget + '&voucher=' + encodeURIComponent(voucher); if (this.$root.useIframe) { this.$root.overlay.frame_src = redirect_url; } else { @@ -1075,10 +1045,7 @@ Vue.component('pretix-widget-event-form', { + '
' + '' + '
' - + '' - + '' - + '' - + '' + + '' + '
' + '' + '
' @@ -1136,7 +1103,13 @@ Vue.component('pretix-widget-event-form', { } else { return strings.buy; } - } + }, + hiddenParams: function () { + var params = new URL(this.$root.voucherFormTarget).searchParams; + params.delete("iframe"); + params.delete("take_cart_id"); + return [...params.entries()]; + }, }, methods: { focus_voucher_field: function() { @@ -1973,6 +1946,9 @@ var shared_root_computed = { if (this.subevent) { form_target += "&subevent=" + this.subevent; } + if (this.$root.widget_data) { + form_target += '&widget_data=' + encodeURIComponent(this.$root.widget_data_json); + } form_target += this.$root.consent_parameter; if (this.$root.additionalURLParams) { form_target += '&' + this.$root.additionalURLParams;