CMM-1949: Fix Application Password login when XML-RPC is unavailable#22782
CMM-1949: Fix Application Password login when XML-RPC is unavailable#22782
Conversation
…ailable When a self-hosted site has XML-RPC disabled, blocked, or returning HTML, the credential storage step fails even though authentication succeeded. This adds a WPAPI fallback path: on DiscoveryException, dispatch a new FETCH_SITE_WP_API_FROM_APPLICATION_PASSWORD action that fetches the site via REST and stores credentials in the same format as the XML-RPC path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevent NullPointerException in fetchPostFormats and fetchProfileXmlRpc when a WPAPI-origin site has no XML-RPC URL. For WPAPI sites, skip XML-RPC calls gracefully instead of crashing. Add an "XML-RPC Disabled" warning card at the top of MySite when a site has valid Application Password credentials but no XML-RPC endpoint. Tapping the card opens a bottom sheet with options to connect Jetpack or learn more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SiteWPAPIRestClient.fetchWPAPISite() was storing AP credentials in the XML-RPC username/password fields instead of apiRestUsernamePlain/ apiRestPasswordPlain. On subsequent FETCH_SITE refreshes, updateSite() preserved existing encrypted AP creds from DB, causing encryptAPIRestCredentials() to skip re-encryption while the wrong username/password fields persisted to the database. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add WPAPI origin guards to all CommentsStore methods that route to CommentsXMLRPCClient, preventing NullPointerException on null xmlRpcUrl. WPAPI sites now receive an INVALID_INPUT error instead of crashing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use red warning icon on MySite card for better visibility - Center card icon vertically - Use same red warning icon in bottom sheet at smaller size with additional vertical spacing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add XMLRPC_DISABLED JetpackConnectionSource for accurate analytics - Revert shared card layout change; scope icon centering to XML-RPC card via centerImageVertically flag on SingleActionCard - Add CommentsStore WPAPI guard tests (fetchComments, fetchCommentsPage, pushComment) - Make fetchSiteWPAPIFromApplicationPassword internal - Rename stale test name to reflect actual assertions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Generated by 🚫 Danger |
|
|
|
|
|
Claude finished @adalpari's task in 4m 28s —— View job Code Review — CMM-1949: Fix Application Password login when XML-RPC is unavailable
Overall this is a well-structured fix addressing a real crash path and improving the login fallback. A few issues are worth attention before merging. Bugs / Medium Severity1.
|
…ekt LargeClass Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Emit OnProfileFetched error event instead of silently returning in fetchProfileXmlRpc when xmlRpcUrl is null - Reset waitingForFetchedSite flag in both success and error handlers to prevent stale flag processing unrelated events - Add missing WPAPI guard tests for fetchComment, createNewComment, createNewReply, updateEditComment, and deleteComment - Change WPAPI guard error type from INVALID_INPUT to GENERIC_ERROR since the issue is unsupported operation, not bad caller input Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #22782 +/- ##
==========================================
+ Coverage 37.41% 37.44% +0.02%
==========================================
Files 2321 2321
Lines 123775 123878 +103
Branches 16804 16821 +17
==========================================
+ Hits 46312 46381 +69
- Misses 73747 73780 +33
- Partials 3716 3717 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@adalpari Looks like there's a problem with the bottom sheet in landscape: landscape.mp4 |
|
I noticed tapping the "Connect Jetpack" button on the bottom sheet uses the old web-based flow. Is it possible to use the new native one? The native flow is more reliable. I asked Claude to summarize how to do this. |
Is it possible to use Chrome Custom Tabs to open the URL? |
What user actions are limited without XML-RPC? |
|
Thanks for the feedback @nbradbury . I'll work on it! |
Basically everything that has not been migrated to AP: posting, old post list?, comments, site settings... I'm not aware of the complete list. But the idea is to let the user know that some parts of the app won't work properly but the app will not crash. |
…rom card Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… sheet Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add bottom margin to card text when Learn more is hidden - Wrap bottom sheet content in ScrollView for landscape scrolling - Expand bottom sheet to STATE_EXPANDED on show Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>




Description
Fixes Application Password login for self-hosted WordPress sites where XML-RPC is disabled or unavailable.
Changes:
DiscoveryException), fall back to fetching the site via WP REST API instead of failing the login flowSiteWPAPIRestClient.fetchWPAPISite()now stores credentials in the correct Application Password fields (apiRestUsernamePlain/apiRestPasswordPlain) instead of the XML-RPCusername/passwordfields, which were being persisted to the database incorrectly on subsequent site refreshesSiteStore.fetchPostFormats(),SiteStore.fetchProfileXmlRpc(), and all 8CommentsStoremethods that route to XML-RPC clients, preventingNullPointerExceptionon nullxmlRpcUrlXMLRPC_DISABLEDtoJetpackConnectionSourcefor accurate trackingTesting instructions
REST fallback login:
XML-RPC disabled warning:
Verify it opens the support URL in the browser
Smoke test the app and notice how the user actions are limited BUT the app does NOT crash
Other regulars logins
Please DO thorough testing here: