Skip to content

Commit 7389005

Browse files
committed
fix allowed characters
1 parent d814775 commit 7389005

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

app/Http/Controllers/WelcomeController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ public function __invoke()
1515

1616

1717
$prepaidBadgesLeft = 0;
18+
$currentEventBadgeCount = 0;
1819
if ($event && Auth::check()) {
1920
$user = Auth::user();
2021
$prepaidBadgesLeft = $user->getPrepaidBadgesLeft($event->id);
22+
$currentEventBadgeCount = $user->badges()->where('event_id', $event->id)->count();
2123
}
2224

2325
return Inertia::render('Welcome', [
@@ -31,6 +33,7 @@ public function __invoke()
3133
'orderEndsAt' => $event->order_ends_at?->toISOString(),
3234
] : null,
3335
'prepaidBadgesLeft' => $prepaidBadgesLeft,
36+
'currentEventBadgeCount' => $currentEventBadgeCount,
3437
]);
3538
}
3639
}

app/Rules/AllowedPritingCharactersRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class AllowedPritingCharactersRule implements ValidationRule
1010
{
1111
public function validate(string $attribute, mixed $value, Closure $fail): void
1212
{
13-
if (! preg_match('/^[!"§$%&\/()=?`²³{[\]}@€~#\'*+,\-.;:_<>|°^¨´µ·×÷¹¼½¾¬«»©®™± äöüÄÖÜßéèêëàâçîïôûùÿñ¡¿]+$/u', $value)) {
14-
$fail(Str::ucfirst($attribute).' can only contain the following allowed characters: !"§$%&/()=?`²³{[]}\@€~#\'*+~,-.;:_<>|°^¨´µ·×÷¹²³¼½¾¬«»©®™± äöüÄÖÜßéèêëàâçîïôûùûÿñ¡¿');
13+
if (! preg_match('/^[a-zA-Z0-9!"§$%&\/()=?`²³{[\]}@€~#\'*+,\-.;:_<>|°^¨´µ·×÷¹¼½¾¬«»©®™± äöüÄÖÜßéèêëàâçîïôùûÿñ¡¿]+$/u', $value)) {
14+
$fail(Str::ucfirst($attribute).' can only contain alphanumeric and the following special characters: !"§$%&/()=?`²³{[]}\@€~#\'*+~,-.;:_<>|°^¨´µ·×÷¹²³¼½¾¬«»©®™± äöüÄÖÜßéèêëàâçîïôûùûÿñ¡¿');
1515
}
1616
}
1717
}

resources/js/Pages/Welcome.vue

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ defineOptions({
2222
const props = defineProps({
2323
showState: String,
2424
event: Object,
25-
prepaidBadgesLeft: Number
25+
prepaidBadgesLeft: Number,
26+
currentEventBadgeCount: Number
2627
});
2728
2829
const currentTime = ref(dayjs());
@@ -47,7 +48,7 @@ const prepaidBadgesLeft = computed(() => props.prepaidBadgesLeft || 0);
4748
4849
const userBadgeOrderedCount = computed(() => {
4950
if (!user.value) return null;
50-
return user.value.badges?.length || 0;
51+
return props.currentEventBadgeCount || 0;
5152
});
5253
5354
const orderStatus = computed(() => {
@@ -100,7 +101,7 @@ const orderStatus = computed(() => {
100101
const userBadgeStatus = computed(() => {
101102
if (!user.value) return null;
102103
103-
const badgeCount = user.value.badges?.length || 0;
104+
const badgeCount = props.currentEventBadgeCount || 0;
104105
const prepaidLeft = prepaidBadgesLeft.value;
105106
106107
if (prepaidLeft > 0) {
@@ -174,7 +175,7 @@ const shouldShowRegMessage = computed(() => {
174175
175176
<!-- Secondary Action Button -->
176177
<Button
177-
v-if="user.badges?.length > 0"
178+
v-if="currentEventBadgeCount > 0"
178179
@click="router.visit(route('badges.index'))"
179180
icon="pi pi-list"
180181
class="flex-1 font-semibold"
@@ -199,7 +200,7 @@ const shouldShowRegMessage = computed(() => {
199200
200201
<!-- Secondary Action Button -->
201202
<Button
202-
v-if="user.badges?.length > 0"
203+
v-if="currentEventBadgeCount > 0"
203204
@click="router.visit(route('badges.index'))"
204205
icon="pi pi-list"
205206
class="flex-1 font-semibold"
@@ -225,10 +226,10 @@ const shouldShowRegMessage = computed(() => {
225226
</div>
226227
227228
<!-- Status Info -->
228-
<div v-if="user.badges?.length > 0" class="flex justify-center mt-6">
229+
<div v-if="currentEventBadgeCount > 0" class="flex justify-center mt-6">
229230
<div class="bg-green-500/90 backdrop-blur-sm rounded-lg px-6 py-2 text-white shadow-lg">
230231
<i class="pi pi-check mr-2"></i>
231-
{{ user.badges.length }} Badge{{ user.badges.length > 1 ? 's' : '' }} Ordered
232+
{{ currentEventBadgeCount }} Badge{{ currentEventBadgeCount > 1 ? 's' : '' }} Ordered
232233
</div>
233234
</div>
234235
</div>
@@ -239,7 +240,7 @@ const shouldShowRegMessage = computed(() => {
239240
Login to customize your fursuit badge that you have bought with your ticket. Additional badges can be ordered at a fee from {{ dayjs(event.orderStartsAt).format('D.M.YYYY') }}.
240241
</p>
241242
<Link
242-
v-if="user.badges?.length > 0"
243+
v-if="currentEventBadgeCount > 0"
243244
:href="route('badges.index')"
244245
class="w-full">
245246
<Button
@@ -266,7 +267,7 @@ const shouldShowRegMessage = computed(() => {
266267
/>
267268
</a>
268269
<Link
269-
v-if="user.badges?.length > 0"
270+
v-if="currentEventBadgeCount > 0"
270271
:href="route('badges.index')"
271272
class="w-full">
272273
<Button
@@ -283,7 +284,7 @@ const shouldShowRegMessage = computed(() => {
283284
<div v-else class="text-center space-y-6">
284285
<p class="text-2xl mb-6 opacity-90">Badge orders are currently closed</p>
285286
<Link
286-
v-if="user.badges?.length > 0"
287+
v-if="currentEventBadgeCount > 0"
287288
:href="route('badges.index')"
288289
class="w-full">
289290
<Button

0 commit comments

Comments
 (0)