Skip to content

Conversation

@CySSoO
Copy link
Contributor

@CySSoO CySSoO commented Sep 14, 2025

Summary

  • add configurable wheel of fortune block in Prettyblocks
  • handle one play per customer without storing emails
  • persist wheel plays in new database table
  • require customer login and generate unique voucher codes on spin
  • show login and account creation forms with newsletter opt-in to capture customer accounts
  • move wheel interface logic to everblock.js using jQuery
  • let admins configure coupon name, prefix, validity and discount type for generated vouchers

Testing

  • php -l controllers/front/wheel.php
  • php -l models/EverblockPrettyBlocks.php

https://chatgpt.com/codex/tasks/task_e_68c5adfc94dc8322a20c50d081b83554

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines 45 to 58
$segments = Tools::getValue('segments');
if (is_string($segments)) {
$segments = json_decode($segments, true);
}
if (!is_array($segments) || empty($segments)) {
die(json_encode([
'status' => false,
'message' => $this->module->l('No segments available', 'wheel'),
]));
}
$prefix = Tools::getValue('coupon_prefix', 'WHEEL');
$validity = (int) Tools::getValue('coupon_validity', 30);
$discountType = Tools::getValue('coupon_type', 'percent');
$couponName = Tools::getValue('coupon_name', 'Wheel reward');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P0] Validate wheel spin parameters server-side

The spin controller reads segments, coupon_prefix, coupon_validity, coupon_type, and coupon_name directly from the POST payload (around lines 45‑58) and uses them to determine which prize wins and what coupon is created, without cross-checking the saved PrettyBlock configuration. Any authenticated user can POST an arbitrary JSON array and discount values to /module/everblock/wheel and obtain a voucher with any amount, percent, validity or code prefix they choose, effectively bypassing the intended probabilities and limits. This allows trivial creation of high-value coupons and undermines the marketing rules for the wheel.

Useful? React with 👍 / 👎.

@CySSoO CySSoO merged commit 1fbd153 into master Sep 14, 2025
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants