feat: Turnstile captcha, menu khách + nút tắt topbar cấu hình từ admin, ẩn setting nhạy cảm

- Turnstile (App\Support\Turnstile, middleware turnstile) cho login admin và login/register/forgot/reset của khách; cấu hình ở setting key=turnstile, secret mã hoá SignRSA.
- Menu sidebar khách (setting client_menu) và nút tắt topbar (setting client_quick_links) do admin sửa qua administrator/client-menu[/quick-links], khách đọc v1/setting/menu, v1/setting/quick-links.
- v1/setting và settings/public chỉ trả whitelist PublicSetting::FIELDS (trước đây lộ bot_token, inet_api_key).
- Cài đặt tài khoản khách (preferences), rate limit theo IP cho register/resend-verify.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-12 15:53:43 +07:00
co-authored by Claude Opus 5.5
parent 823af4a56a
commit e888a6ed5d
33 changed files with 1022 additions and 52 deletions
@@ -205,16 +205,16 @@ class ProductController extends Controller
{
$currency = $data['currency'] ?? 'VND';
$cycles = [
'monthly' => 'price_monthly',
'quarterly' => 'price_quarterly',
'semi_annually' => 'price_semiannually',
'annually' => 'price_annually',
'biennially' => 'price_biennially',
'triennially' => 'price_triennially',
'onetime' => 'price_onetime',
'monthly' => ['price_monthly', []],
'quarterly' => ['price_quarterly', []],
'semi_annually' => ['price_semiannually', ['semiannually']],
'annually' => ['price_annually', []],
'biennially' => ['price_biennially', []],
'triennially' => ['price_triennially', []],
'onetime' => ['price_onetime', ['one_time']],
];
foreach ($cycles as $cycle => $field) {
foreach ($cycles as $cycle => [$field, $legacyCycles]) {
if (!array_key_exists($field, $data)) {
continue;
}
@@ -226,9 +226,12 @@ class ProductController extends Controller
['product_id' => $product->id, 'billing_cycle' => $cycle],
['price' => $price, 'currency' => $currency, 'is_active' => true]
);
ProductPricings::where('product_id', $product->id)
->whereIn('billing_cycle', $legacyCycles)
->delete();
} else {
ProductPricings::where('product_id', $product->id)
->where('billing_cycle', $cycle)
->whereIn('billing_cycle', [$cycle, ...$legacyCycles])
->delete();
}
}