enhancement(settings): hide Subscription Token value on settings page#4324
Open
faisalahammad wants to merge 1 commit into
Open
enhancement(settings): hide Subscription Token value on settings page#4324faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
- Change token input from type=text to type=password - Remove token value from HTML, use masked placeholder instead - Preserve existing token in DB when field submitted empty - Update description text to reflect new behavior Fixes 10up#4305
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Subscription Token for ElasticPress.io users was displayed in plain text on the Settings page. This change hides the value by using a password field, and it preserves the existing token when the form is submitted without a new value.
Fixes #4305
Changes
includes/partials/settings-page.phpBefore:
After:
Why: Type password alone was not enough because the browser could still expose the value via DevTools. Leaving the value empty and using a placeholder means the token is never sent back to the browser.
includes/classes/Screen/Settings.phpBefore:
After:
Why: Since the token input is always empty on page load, an empty POST value means the user did not change it. This prevents overwriting the stored token with an empty value on every save.
Testing
Test 1: Token is not exposed in the page
value=""and that the actual token is not in the DOM.Result: Token not exposed in page source.
Test 2: Save without changing the token
Result: Existing token is preserved.
Test 3: Update the token
Result: New token is saved correctly.
Screenshots
Before:

After:
