Skip to content

Log the wp-admin link in, and show the admin password in plain text - #793

Open
ryanwelcher wants to merge 1 commit into
trunkfrom
update/743-admin-link-logs-you-in
Open

ryanwelcher wants to merge 1 commit into
trunkfrom
update/743-admin-link-logs-you-in

Conversation

@ryanwelcher

@ryanwelcher ryanwelcher commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The site details hide the admin password behind a toggle, but it is password on 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

  • The wp-admin link (details panel, header menu, wizard) now opens the dashboard logged in as admin. It uses Playground's own forced auto-login: every site is served with PLAYGROUND_FORCE_AUTO_LOGIN_ENABLED, and the link carries ?playground_force_auto_login_as_user=admin.
  • Only the link logs you in. The front end and wp-login.php stay 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's login: true, which logs in every visitor.
  • The password is shown in plain text. The show/hide toggle is gone.
  • The user name the link logs in as and the one the credentials show come from one constant, ADMIN_USERNAME in site-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).

  1. Click Start dev server. In the details under Server, Admin credentials shows Username admin and Password password, with no show/hide button.
  2. Click wp-admin. The browser opens the WordPress Dashboard, not the login form.
  3. In the same browser, open the site's front page. The admin bar is there, since you are now logged in.
  4. Log out from the admin bar, then click wp-admin in the app again. You land on the Dashboard again.
  5. Optional: repeat steps 1-2 on a Gutenberg site. The link works there too.

What must not have happened:

  • Opening View site in a fresh private window (without clicking wp-admin first) must show the site logged out, with no admin bar.
  • Visiting wp-login.php directly in a fresh private window must show the login form, not redirect to the dashboard.

The dev-server and site-links journeys cover the link's address and the visible password. The real login is covered by a new check in tests/e2e/real-setup/create-site.spec.js, which only runs in the manual real-setup.yml workflow.

Risks and limitations

  • The feature depends on two names from Playground (the constant and the query parameter). If a Playground upgrade renames them, the link falls back to the login form. The new real-setup check catches that, but only when real-setup.yml is run.
  • The link logs in anyone who opens it. The server listens on the loopback only, and the password is password on every site already, so this adds no exposure.
  • The password shown is a fixed value, not read from the site. If someone changes the admin password in wp-admin, the details still show 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.
  • Review: 2 [fix here], both fixed.

Related

Fixes #743. Follow-up to #4.


Design decisions and alternatives considered
  • Playground's login: true logs every new browser in on any page. Rejected because it makes logged-out testing awkward.
  • A mu-plugin of our own that logs in on a query would duplicate what Playground already ships behind PLAYGROUND_FORCE_AUTO_LOGIN_ENABLED.
  • Only showing the password (the issue's first option) is in here too. It still helps if someone types /wp-admin/ by hand.
Review outcome (required — see AGENTS.md)
  • Review: completed. Reviewer: separate agent context (Claude Code self-review) against .github/instructions/code-review.instructions.md. It covered the uncommitted working tree on base 8ac1794. npm run lint clean; npm test 2318 pass, 0 fail at the time. Outcome: 2 [fix here] · 0 [follow-up].
    1. 🟡 Tests: nothing proved the link logs in on a real server. Fixed: create-site.spec.js now requests the link's address and asserts the dashboard (wpadminbar, no loginform).
    2. 🔵 Architecture: the user name admin was written twice (link and credentials). Fixed: both come from ADMIN_USERNAME, with a unit test that the link logs in as the user the credentials name.
    • Notes also applied: docs wording and alt text in running-the-site.md, regenerated dev-server-running.png, and the server-runner.js comment.
  • Since review: the two fixes and notes above, committed as 1d70824. Checked by hand, not re-reviewed by a fresh context. After the fixes: lint clean; npm test 2319 pass, 0 fail. The dev-server, site-links and i18n journeys passed with the windows hidden, except "the Logs are fully translatable" in i18n.spec.js. That test also fails intermittently on trunk at 8ac1794 (1 of 2 hidden runs), so it is not from this branch.
  • Review: completed — CodeRabbit, requested with @coderabbitai review; reviewed head 1d70824 / base 8ac1794; check passed and the summary comment reads "No actionable comments were generated in the recent review."
Implementation notes
  • Playground's mu-plugin (@wp-playground/wordpress, 1-auto-login.php) logs in on init priority 1 and fills $_COOKIE in-process, so auth_redirect() on /wp-admin/ sees the session on the same request.
  • I checked it against a real @wp-playground/cli server: plain /wp-admin/ ends on wp-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.
  • I didn't run the real-setup spec locally because it clones and builds wordpress-develop. Its test list still loads (--list).
Screenshots or recording

After (regenerated docs screenshot): the password is shown, no toggle.

Site details with the server running, admin credentials showing username admin and password password

Before: the same panel showed •••••••• with an eye button.

🤖 Generated with Claude Code

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.
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The app enables forced auto-login for both serve strategies. Its wp-admin link includes a query parameter for the admin user, and the server credentials use the same username. The site details display the password as plain text and no longer include a show/hide control. Unit and end-to-end tests now check the updated URL, visible credentials, and logged-in dashboard.

Assessment against linked issues

Objective Addressed Explanation
Show the site password or provide an admin link that logs in automatically [#743] ✅

Possibly related issues

  • Issue 743 is directly linked to this PR, so it is not listed as an additional related issue.

Severity of issue fixed: Low

Merge Risk: Minimal · up to 1d708 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 1

Check name Status Explanation
Description check Passed The description follows the repository template closely. It has Why, What changes, How to test this (with platform, starting state, and must-not-have-happened items), Risks and limitations, Related, a…
Full details: Description check

Explanation

The description follows the repository template closely. It has Why, What changes, How to test this (with platform, starting state, and must-not-have-happened items), Risks and limitations, Related, and the collapsible Design decisions, Review outcome, Implementation notes, and Screenshots sections. It states the problem (hidden password, issue #743), the approach (forced auto-login via PLAYGROUND_FORCE_AUTO_LOGIN_ENABLED and a query parameter), and the scope exclusions. It names the test that covers the link address and visible password. It also names the real-setup check and says it does not run in the default suite. The Review outcome section records a completed review with outcomes and a fresh head SHA. The 'Related' section uses 'Fixes #743', which correctly closes the issue. Minor gap: the 'How to test' section gives a manual flow and a regression check, and the 'Why' section is concise. Overall the description is complete and specific.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8ac1794 and 1d70824.

Files ignored due to path filters: 1

  • docs/public/screenshots/dev-server-running.png is excluded by !**/*.png
Files selected for processing: 14

  • docs/guide/running-the-site.md
  • src/playground-plan.cjs
  • src/renderer/components/site-details.jsx
  • src/renderer/shell.css
  • src/renderer/site-processes.cjs
  • src/renderer/site-urls.cjs
  • src/server-runner.js
  • tests/e2e/journeys/dev-server.spec.js
  • tests/e2e/journeys/i18n.spec.js
  • tests/e2e/journeys/site-links.spec.js
  • tests/e2e/real-setup/create-site.spec.js
  • tests/unit/playground-plan.test.cjs
  • tests/unit/site-processes.test.cjs
  • tests/unit/site-urls.test.cjs
Files with no reviewable changes: 2

  • src/renderer/shell.css
  • tests/e2e/journeys/i18n.spec.js

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@ryanwelcher

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI 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.

🔵 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

This branch has not been deployed

No deployments
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.

Show the site password, or add an admin link that logs you in

2 participants