Skip to content

fix(embed): redirect URL after submit + themed success message#75

Merged
devCluna merged 2 commits into
mainfrom
fix/redirect-and-success-theme
Jul 10, 2026
Merged

fix(embed): redirect URL after submit + themed success message#75
devCluna merged 2 commits into
mainfrom
fix/redirect-and-success-theme

Conversation

@devCluna

@devCluna devCluna commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Two embed fixes for the submit flow.

  • Redirect after submit — the redirectUrl form setting was dead (never read by the embed). On submit, the form now navigates to it (window.location.href) when set; otherwise it shows the success message.
  • Themed success message — the success <p> was appended after the themed <form> was cleared, so it lost the theme. It's now wrapped in .sfb-form with the resolved --sfb-* variables re-applied, keeping fonts/colors on-theme (matters on third-party embeds where there's no page card to inherit from). Small padding tweak on .sfb-success.

Verification

End-to-end via a cross-origin embed page (localhost:8080 → Strapi on :1338): auto-fills, submits, and the page navigates to the configured redirect URL. Type-check (server + admin), 31/31 tests, build all pass. No dependency changes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Forms can now redirect visitors to a configured URL after successful submission.
    • Success messages now preserve the form’s theme styling when displayed inline.
  • Style

    • Improved success message spacing and readability.

…e themed

- The `redirectUrl` setting was never applied — on submit the embed now redirects
  to it (window.location.href) when set, otherwise shows the success message.
- The success message was appended after the themed <form> was cleared, losing the
  theme. It's now wrapped in .sfb-form with the resolved --sfb-* vars re-applied, so
  it stays styled (notably on third-party embeds where there's no card to inherit
  from). Small padding tweak on .sfb-success.

Verified end-to-end: a cross-origin embed auto-submits and navigates to the redirect.
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@devCluna, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 85090982-5fb3-4ac9-a747-e87ee1316d34

📥 Commits

Reviewing files that changed from the base of the PR and between 1a91916 and 2bff257.

📒 Files selected for processing (1)
  • server/src/controllers/form.ts
📝 Walkthrough

Walkthrough

Changes

Form success flow

Layer / File(s) Summary
Success handling and presentation
server/src/controllers/form.ts, admin/src/form-css.ts
Post-submit handling redirects when configured or renders a themed .sfb-form success wrapper, while .sfb-success receives updated sizing and spacing styles.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a bunny hopping through the form,
With redirects ready to perform.
Success gets styled, wrapped, and bright,
Then hops along to its next delight.
Thump-thump—submitted just right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main changes: post-submit redirect behavior and the themed success message.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/redirect-and-success-theme

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@server/src/controllers/form.ts`:
- Around line 228-244: Validate form.settings.redirectUrl before assigning it in
the submit-success logic: allow only relative URLs or http/https URLs, and
reject javascript: or other schemes. When invalid, restore the submit button’s
enabled state before continuing to the success-message path; only assign
window.location.href for validated redirects.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5deedfaa-2f4f-4297-a812-331ed1c4b164

📥 Commits

Reviewing files that changed from the base of the PR and between 9d3c2d9 and 1a91916.

📒 Files selected for processing (2)
  • admin/src/form-css.ts
  • server/src/controllers/form.ts

Comment thread server/src/controllers/form.ts Outdated
@devCluna
devCluna merged commit 5965767 into main Jul 10, 2026
3 checks passed
@devCluna
devCluna deleted the fix/redirect-and-success-theme branch July 10, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant