Conversation
For some reason, they were preventing me from using the banner component in a server component.
WalkthroughThe pull request adds Cloudflare Turnstile verification to registration, password reset, event creation, and availability submission flows. It introduces guest-import APIs and frontend pages for reviewing and transferring guest events and participations, including conflict resolution. User events gain unique public UUIDs through staged migrations. Frontend API types, protected routes, navigation, dialogs, loading states, and guest-mode messaging are updated to support these flows. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)backend/requirements.txtTraceback (most recent call last): ... [truncated 567 characters] ... pydantic/init.py", line 5, in frontend/package.jsonTraceback (most recent call last): ... [truncated 567 characters] ... pydantic/init.py", line 5, in Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 11
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4a1468eb-c303-4a6d-8894-b391778227aa
⛔ Files ignored due to path filters (1)
frontend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (56)
backend/.env.examplebackend/api/auth/views.pybackend/api/availability/views.pybackend/api/decorators.pybackend/api/docs/utils.pybackend/api/docs/views.pybackend/api/event/utils.pybackend/api/event/views.pybackend/api/guest_import/serializers.pybackend/api/guest_import/urls.pybackend/api/guest_import/utils.pybackend/api/guest_import/views.pybackend/api/migrations/0034_userevent_public_id.pybackend/api/migrations/0035_populate_public_id.pybackend/api/migrations/0036_apply_unique_constraint.pybackend/api/models.pybackend/api/settings.pybackend/api/urls.pybackend/api/utils.pybackend/requirements.txtfrontend/.env.examplefrontend/package.jsonfrontend/src/app/(auth)/forgot-password/page.tsxfrontend/src/app/(auth)/login/page.tsxfrontend/src/app/(auth)/register/page.tsxfrontend/src/app/(event)/[event-code]/painting/page-client.tsxfrontend/src/app/dashboard/page-client.tsxfrontend/src/app/guest-import/import/loading.tsxfrontend/src/app/guest-import/import/page-client.tsxfrontend/src/app/guest-import/import/page.tsxfrontend/src/app/guest-import/layout.tsxfrontend/src/app/guest-import/login/page-client.tsxfrontend/src/app/guest-import/login/page.tsxfrontend/src/app/settings/(submenus)/guest-import/page.tsxfrontend/src/app/settings/loading.tsxfrontend/src/components/captcha.tsxfrontend/src/components/layout/message-page.tsxfrontend/src/features/account/setting-dialogs/change-password/main-dialog.tsxfrontend/src/features/account/setting-dialogs/delete-account.tsxfrontend/src/features/account/settings/sidebar-nav.tsxfrontend/src/features/drawer/components/base.tsxfrontend/src/features/event/editor/editor.tsxfrontend/src/features/guest-import/components/guest-summary.tsxfrontend/src/features/guest-import/constants.tsfrontend/src/features/selector/components/drawer.tsxfrontend/src/features/system-feedback/dialog/components/base.tsxfrontend/src/features/system-feedback/dialog/components/confirmation.tsxfrontend/src/features/system-feedback/dialog/components/form.tsxfrontend/src/features/system-feedback/dialog/props.tsfrontend/src/features/system-feedback/toast/context.tsfrontend/src/lib/messages.tsfrontend/src/lib/utils/api/endpoints.tsfrontend/src/lib/utils/api/fetch-wrapper.tsfrontend/src/lib/utils/api/submit-event.tsfrontend/src/lib/utils/api/types.tsfrontend/src/middleware.ts
💤 Files with no reviewable changes (1)
- frontend/src/features/account/setting-dialogs/change-password/main-dialog.tsx
This PR adds CAPTCHA to the site, in the form of Cloudflare Turnstile. I chose that solution over reCAPTCHA and hCAPTCHA because of the unlimited free use and focus on privacy.
@require_captchaDecoratorThis decorator can be added to any endpoint to require a CAPTCHA token before processing any data. This decorator will send the token from the client to an endpoint on Cloudflare's servers. If the token is not supplied or invalid, an error is returned with a relevant message.
This was applied to:
/auth/register//auth/start-password-reset//availability/add//event/date-create//event/week-create/.envUpdatesThe site key and secret key were added to the frontend and backend
.env.examplefiles, respectively. These values are used by Cloudflare to identify our project and validate users. The placeholders in.env.exampleare development keys that automatically verify users.New
CaptchaComponentThis component serves a few different purposes:
.envto a random string will trigger this..envto a random string will trigger this.The experience should be no different than it is now, assuming the user passes the challenge. This CAPTCHA challenge operates completely in the background until something fails.
Loosened Account Creation Rate Limits
Now that we have CAPTCHA, it reduces the risk of bots spamming our servers. We're now able to loosen the rate limits so more human users can create accounts at once.
New
ApiErrorDataPropertyA new property was added,
captchaFailed, which checks if the error messages include the string returned from the@require_captchadecorator. I know it's not the most ideal solution, but later I plan to introduce some sort of error code structure to backend error responses and this will be resolved.New Packages
The frontend got the
@marsidev/react-turnstilepackage, which is a community-made widget that makes using Cloudflare Turnstile really easy.The backend got the
requestspackage to make requests that test client tokens against Cloudflare's servers.Backend Docs Updates
A new property,
captcha_required, was added to each endpoint to denote if a CAPTCHA token is required.The
UUIDFieldwas also given support since I forgot to fix this earlier and I couldn't test the docs endpoint without it. I also fixed this in a different branch, but it should resolve fine when merged.This PR must be merged after #365.