Opened 6 weeks ago
Last modified 6 weeks ago
#66193 new defect (bug)
wpmu_activate_signup() reports a password that was never set when the user already exists
| Reported by: | abhishekfdd | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Login and Registration | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description
In wpmu_activate_signup(), $password is generated before the username_exists() check. If the user already exists and the signup includes a site, that password is never applied to the account, but it is still:
- passed to the
wpmu_activate_blogaction, - emailed by
wpmu_welcome_notification()through the defaultPassword: PASSWORDtemplate, - displayed on
wp-activate.php.
[49078] documented $password as "User password, or "N/A" if the user account is not new" for wpmu_welcome_notification(), and wp-admin/network/site-new.php already passes 'N/A', but wpmu_activate_signup() never does.
Steps to reproduce
- On a multisite with site registration enabled, create a site signup for a new user via
wp-signup.php. - Make the first activation fail during site creation, for example by adding an error on
wp_validate_site_data. The user is created, the site is not. - Visit the activation link again.
Expected: the page and welcome email do not show a password, since none was generated for the account.
Actual: the site is created, and the page and welcome email show a new password that does not work. The password set on the first attempt was never shown to anyone, so the user can only get in via password reset.
Reachability
Not reachable through wp-signup.php validation alone, since wpmu_validate_user_signup() rejects existing usernames. It is reachable when site creation fails partway and the link is retried, with concurrent activations of the same key, and when plugins call wpmu_signup_blog() for existing users.
Proposed fix
Generate the password only when the user is created in wpmu_activate_signup(), otherwise use 'N/A', matching the docblock and site-new.php. Patch and unit tests to follow.
Related: #38474 (PR 8710 also modifies wpmu_activate_signup() and adds a test class named Tests_Multisite_wpmuActivateSignup), #33209, #31127.
Attachments (1)
Change History (2)
This ticket was mentioned in PR #13778 on WordPress/wordpress-develop by @abhishekfdd.
6 weeks ago
#1
- Keywords has-patch has-unit-tests added
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Generates the activation password in
wpmu_activate_signup()only when the user is actually created. When the user already exists,'N/A'is passed towpmu_activate_blog, the welcome email andwp-activate.php, matching the documented behavior from [49078] and whatnetwork/site-new.phpalready does.Adds tests for:
'N/A'returned, existing password unchanged,'N/A'returned and in the welcome email.See #66193.
Trac ticket: https://core.trac.wordpress.org/ticket/66193
Use of AI Tools
AI assistance: Yes
Tool: Claudecode
Model(s): Opus 5.5
Used for: Initial code skeleton and test suggestions; final implementation and tests were reviewed and edited by me.