Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Masked inputs always look the same when value is hidden #15025

Merged
merged 3 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/15025.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: masked values no longer give away length or location of special characters
```
10 changes: 5 additions & 5 deletions ui/lib/core/addon/templates/components/masked-input.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
data-test-field
>
{{#if this.displayOnly}}
<pre class="masked-value display-only is-word-break {{unless this.showValue 'masked-font'}}">{{unless
this.showValue
(truncate this.value 20)
this.value
}}</pre>
{{#if this.showValue}}
<pre class="masked-value display-only is-word-break">{{this.value}}</pre>
{{else}}
<pre class="masked-value display-only masked-font">***********</pre>
{{/if}}
{{else if this.inputField}}
<input
autocomplete="off"
Expand Down
2 changes: 1 addition & 1 deletion ui/tests/acceptance/secrets/backend/kv/secret-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ module('Acceptance | secrets/secret/create', function (hooks) {
assert.dom('[data-test-list-item-content]').exists({ count: 1 }, 'renders a single version');

await click('.linked-block');

await click('button.button.masked-input-toggle');
assert.dom('[data-test-masked-input]').hasText('bar', 'renders secret on the secret version show page');
assert.equal(
currentURL(),
Expand Down
4 changes: 2 additions & 2 deletions ui/tests/integration/components/masked-input-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ module('Integration | Component | masked input', function (hooks) {
assert.dom('.masked-value').hasClass('masked-font');
});

test('it shortens long outputs when displayOnly and masked', async function (assert) {
test('it shortens all outputs when displayOnly and masked', async function (assert) {
this.set('value', '123456789-123456789-123456789');
await render(hbs`{{masked-input value=value displayOnly=true}}`);
let maskedValue = document.querySelector('.masked-value').innerText;
assert.equal(maskedValue.length, 20);
assert.equal(maskedValue.length, 11);

await component.toggleMasked();
let unMaskedValue = document.querySelector('.masked-value').innerText;
Expand Down