Skip to content

Dashboard | Fix redirect after unlocking#3733

Merged
tvdeyen merged 1 commit intoAlchemyCMS:mainfrom
metikular:fix/dashboard-unlock-redirect
Mar 7, 2026
Merged

Dashboard | Fix redirect after unlocking#3733
tvdeyen merged 1 commit intoAlchemyCMS:mainfrom
metikular:fix/dashboard-unlock-redirect

Conversation

@phylor
Copy link
Copy Markdown
Contributor

@phylor phylor commented Mar 7, 2026

What is this pull request for?

Currently, when unlocking a page from the dashboard, the user is always redirected to the pages index.

The unlock form action supplies a redirect_to parameter, which allows to redirect back to the dashboard. Currently this parameter is a URL, e.g. https://example.com/admin/dashboard.

The URL then fails the
BaseController#is_safe_redirect_path? check, because that method only supports paths. It never matches against URLs with domains and scheme.

We therefore set the redirect_to parameter of the unlock form action to the path, instead of the URL.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.47%. Comparing base (a405222) to head (0a51d02).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3733   +/-   ##
=======================================
  Coverage   97.47%   97.47%           
=======================================
  Files         314      314           
  Lines        8303     8303           
=======================================
  Hits         8093     8093           
  Misses        210      210           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Currently, when unlocking a page from the dashboard, the user is always
redirected to the pages index.

The `unlock` form action supplies a `redirect_to` parameter, which
allows to redirect back to the dashboard. Currently this parameter is a
URL, e.g. `https://example.com/admin/dashboard`.

The URL then fails the
`BaseController#is_safe_redirect_path?` check, because that method only
supports paths. It never matches against URLs with domains and scheme.

We therefore set the `redirect_to` parameter to the path, instead of the
URL.
@phylor phylor force-pushed the fix/dashboard-unlock-redirect branch from 87a9411 to 0a51d02 Compare March 7, 2026 11:49
@phylor phylor marked this pull request as ready for review March 7, 2026 12:03
@phylor phylor requested a review from a team as a code owner March 7, 2026 12:03
Copy link
Copy Markdown
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Great find! Thanks

@tvdeyen tvdeyen added backport-to-8.0-stable Needs to be backported to 8.0-stable backport-to-8.1-stable Needs to be backported to 8.1-stable bug labels Mar 7, 2026
@tvdeyen tvdeyen merged commit a5e74a4 into AlchemyCMS:main Mar 7, 2026
30 checks passed
@alchemycms-bot
Copy link
Copy Markdown

alchemycms-bot bot commented Mar 7, 2026

💚 All backports created successfully

Status Branch Result
8.0-stable
8.1-stable

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

@alchemycms-bot alchemycms-bot bot mentioned this pull request Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-8.0-stable Needs to be backported to 8.0-stable backport-to-8.1-stable Needs to be backported to 8.1-stable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants