fix(public): do not expose coupon code after preregistration

Codes are still created and stored for Mailwizz; JSON response omits
coupon_code. Thank-you UI explains email delivery instead of showing code.

Made-with: Cursor
This commit is contained in:
2026-04-05 11:22:38 +02:00
parent 217e1d9afb
commit 9f8052f683
4 changed files with 3 additions and 42 deletions

View File

@@ -71,7 +71,6 @@ class PublicPageController extends Controller
return response()->json([
'success' => true,
'message' => $publicPage->thank_you_message ?? __('Thank you for registering!'),
'coupon_code' => $subscriber->fresh()?->coupon_code,
]);
}

View File

@@ -420,7 +420,6 @@ document.addEventListener('alpine:init', () => {
redirectSecondsLeft: null,
redirectTimer: null,
strings: config.strings || {},
couponCode: '',
copyPageLink() {
const url = this.pageShareUrl;
@@ -435,19 +434,6 @@ document.addEventListener('alpine:init', () => {
});
},
copyCouponCode() {
const code = this.couponCode;
if (!code) {
return;
}
navigator.clipboard.writeText(code).then(() => {
this.copyFeedback = this.strings?.couponCopied || '';
setTimeout(() => {
this.copyFeedback = '';
}, 2500);
});
},
init() {
if (this.phase === 'before') {
this.tickCountdown();
@@ -566,8 +552,6 @@ document.addEventListener('alpine:init', () => {
if (res.ok && data.success) {
this.phase = 'thanks';
this.thankYouMessage = data.message ?? '';
this.couponCode =
typeof data.coupon_code === 'string' && data.coupon_code !== '' ? data.coupon_code : '';
this.startRedirectCountdownIfNeeded();
return;
}

View File

@@ -156,30 +156,9 @@
</div>
</div>
<p class="whitespace-pre-line text-center text-base leading-relaxed text-white/95 sm:text-lg" x-text="thankYouMessage"></p>
<template x-if="couponCode">
<div class="mt-6 rounded-xl border border-white/20 bg-white/10 p-6 backdrop-blur">
<p class="text-center text-sm text-white/70">{{ __('Jouw kortingscode') }}</p>
<div class="mt-3 flex flex-wrap items-center justify-center gap-3">
<span
class="font-mono text-2xl font-bold tracking-wider text-festival"
x-text="couponCode"
></span>
<button
type="button"
class="rounded-lg border border-white/25 p-2 text-white/70 transition hover:border-white/40 hover:text-white"
@click="copyCouponCode()"
aria-label="{{ __('Kortingscode kopiëren') }}"
>
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184" />
</svg>
</button>
</div>
<p class="mt-3 text-center text-xs text-white/50">
{{ __('Gebruik deze code bij het afrekenen in de ticketshop.') }}
</p>
</div>
</template>
<p class="mt-4 text-center text-sm leading-relaxed text-white/65">
{{ __('Je persoonlijke kortingscode wordt niet hier getoond. Je ontvangt die per e-mail wanneer de organisatie de ticketverkoop opent — houd je inbox in de gaten.') }}
</p>
<p
x-show="redirectSecondsLeft !== null && redirectSecondsLeft > 0"
x-cloak

View File

@@ -71,7 +71,6 @@
'redirectUrl' => filled($redirectAfterSubmit) ? $redirectAfterSubmit : null,
'strings' => [
'linkCopied' => __('Link gekopieerd!'),
'couponCopied' => __('Kortingscode gekopieerd!'),
'redirectCountdown' => __('You will be redirected in :seconds s…'),
],
]))"