Repository navigation
Log the wp-admin link in, and show the admin password in plain text - #793
ryanwelcher wants to merge 1 commit into
Conversation
Every site's admin password is `password`, so hiding it behind a toggle only cost a click. The wp-admin link now asks Playground's own forced auto-login (PLAYGROUND_FORCE_AUTO_LOGIN_ENABLED, set for every site) to log the browser in as admin, so it opens the dashboard rather than the login form. The front end and wp-login.php stay logged out. Fixes #743.
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Low Merge Risk:
|
|
@coderabbitai review |
Action performed
|
There was a problem hiding this comment.
🔵 Needs a closer look
The real-setup check was not executed, leaving Playground’s PHP-runtime-dependent Core and Gutenberg login/logout and fresh-client logged-out behavior unverified on the current-head build.
No open issues 🎉
What changed in this PR
This PR simplifies dashboard access for Contributor Toolkit users, addressing #743 by making wp-admin links log in as admin and displaying the fixed password directly.
Changes:
- Enables Playground’s query-triggered auto-login for Core and Gutenberg sites, while preserving logged-out access through ordinary site links.
- Shares the admin username between links and credentials, and removes the password toggle.
- Updates unit tests, browser journeys, the manual real-setup check, and user documentation.
| File | Description |
|---|---|
tests/unit/site-urls.test.cjs |
Checks auto-login URLs and the canonical admin path. |
tests/unit/site-processes.test.cjs |
Checks that links and credentials name the same user. |
tests/unit/playground-plan.test.cjs |
Checks auto-login configuration for both site strategies. |
tests/e2e/real-setup/create-site.spec.js |
Adds a real-server dashboard login assertion. |
tests/e2e/journeys/site-links.spec.js |
Updates the expected middle-click destination. |
tests/e2e/journeys/i18n.spec.js |
Removes assertions for the deleted password toggle. |
tests/e2e/journeys/dev-server.spec.js |
Checks auto-login links and the visible password. |
src/server-runner.js |
Updates a comment describing server constants. |
src/renderer/site-urls.cjs |
Adds the auto-login query and shared admin username. |
src/renderer/site-processes.cjs |
Uses the shared username for credentials. |
src/renderer/shell.css |
Removes unused password-toggle layout styles. |
src/renderer/components/site-details.jsx |
Displays the password without a toggle. |
src/playground-plan.cjs |
Enables forced auto-login for both site strategies. |
docs/guide/running-the-site.md |
Documents automatic login and updates screenshot alt text. |
Review effort: Balanced
Why
The site details hide the admin password behind a toggle, but it is
passwordon every site. At WordCamp Canada Contributor Day, newcomers still had to find the toggle, then type credentials into wp-admin. #743 asks to show it, or better, have the wp-admin link log you in.What changes
admin. It uses Playground's own forced auto-login: every site is served withPLAYGROUND_FORCE_AUTO_LOGIN_ENABLED, and the link carries?playground_force_auto_login_as_user=admin.wp-login.phpstay logged out, so tickets about the logged-out view or the login screen can still be tested. This is why I did not use Playground'slogin: true, which logs in every visitor.ADMIN_USERNAMEinsite-urls.cjs.Not in this PR: an "opens in your browser" icon on links. Every link in the app already opens in the browser, so that would be an app-wide change.
How to test this
Platforms: any. Use the Buildkite build for the current head.
Starting state: a Core site that has finished setup, dev server stopped, and a browser not logged in to that site (a private window is easiest).
adminand Passwordpassword, with no show/hide button.What must not have happened:
wp-login.phpdirectly in a fresh private window must show the login form, not redirect to the dashboard.The
dev-serverandsite-linksjourneys cover the link's address and the visible password. The real login is covered by a new check intests/e2e/real-setup/create-site.spec.js, which only runs in the manualreal-setup.ymlworkflow.Risks and limitations
real-setup.ymlis run.passwordon every site already, so this adds no exposure.password. This was already true behind the toggle, but it's more visible now. The wp-admin link still works, because auto-login doesn't check the password. Whether to keep showing the credentials at all is Decide whether to keep showing the admin credentials once the wp-admin link logs you in #797.Related
Fixes #743. Follow-up to #4.
Design decisions and alternatives considered
login: truelogs every new browser in on any page. Rejected because it makes logged-out testing awkward.PLAYGROUND_FORCE_AUTO_LOGIN_ENABLED./wp-admin/by hand.Review outcome (required — see AGENTS.md)
self-review) against.github/instructions/code-review.instructions.md. It covered the uncommitted working tree on base8ac1794.npm run lintclean;npm test2318 pass, 0 fail at the time. Outcome: 2 [fix here] · 0 [follow-up].create-site.spec.jsnow requests the link's address and asserts the dashboard (wpadminbar, nologinform).adminwas written twice (link and credentials). Fixed: both come fromADMIN_USERNAME, with a unit test that the link logs in as the user the credentials name.running-the-site.md, regenerateddev-server-running.png, and theserver-runner.jscomment.1d70824. Checked by hand, not re-reviewed by a fresh context. After the fixes: lint clean;npm test2319 pass, 0 fail. Thedev-server,site-linksandi18njourneys passed with the windows hidden, except "the Logs are fully translatable" ini18n.spec.js. That test also fails intermittently on trunk at8ac1794(1 of 2 hidden runs), so it is not from this branch.@coderabbitai review; reviewed head1d70824/ base8ac1794; check passed and the summary comment reads "No actionable comments were generated in the recent review."Implementation notes
@wp-playground/wordpress,1-auto-login.php) logs in oninitpriority 1 and fills$_COOKIEin-process, soauth_redirect()on/wp-admin/sees the session on the same request.@wp-playground/cliserver: plain/wp-admin/ends onwp-login.php?reauth=1; the link's address ends on the Dashboard, and later requests stay logged in; a fresh client's front end has no admin bar.wordpress-develop. Its test list still loads (--list).Screenshots or recording
After (regenerated docs screenshot): the password is shown, no toggle.
Before: the same panel showed
••••••••with an eye button.🤖 Generated with Claude Code