Commit a7b5ed37 authored by Rainhard Findling's avatar Rainhard Findling Committed by Chromium LUCI CQ

Password check: show weak CTA for weak passwords

* Make the button next to weak passwords white (instead of blue for
  compromised passwords).
* Adapt the color of the "external" icon in the button to the button's
  strong or weak CTA, including for dark mode.
* Screenshots: screen/3QHcFDpoZTpovNP, screen/6oPv3M82uqZAxk3

Bug: 1128904
Change-Id: Ibea49560a033d51b143b6eacdf08a205a8801d14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2599859Reviewed-by: default avatarRainhard Findling <rainhard@chromium.org>
Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Rainhard Findling <rainhard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842030}
parent ffb18d93
...@@ -65,6 +65,17 @@ ...@@ -65,6 +65,17 @@
justify-content: flex-end; justify-content: flex-end;
} }
.icon-weak-cta {
fill: var(--google-blue-600);
}
/* dark mode */
@media (prefers-color-scheme: dark) {
.icon-weak-cta {
fill: var(--google-blue-refresh-300);
}
}
:host-context([dir='rtl']) #insecureOrigin { :host-context([dir='rtl']) #insecureOrigin {
justify-content: flex-start; justify-content: flex-start;
} }
...@@ -107,10 +118,11 @@ ...@@ -107,10 +118,11 @@
</div> </div>
<template is="dom-if" if="[[item.changePasswordUrl]]"> <template is="dom-if" if="[[item.changePasswordUrl]]">
<div class="button-container" id="changePasswordUrl"> <div class="button-container" id="changePasswordUrl">
<cr-button id="changePasswordButton" class="action-button" <cr-button id="changePasswordButton" class$="[[buttonClass_]]"
on-click="onChangePasswordClick_"> on-click="onChangePasswordClick_">
$i18n{changePasswordButton} $i18n{changePasswordButton}
<iron-icon icon="cr:open-in-new" id="change-password-link-icon"> <iron-icon icon="cr:open-in-new" id="change-password-link-icon"
class$="[[iconClass_]]">
</iron-icon> </iron-icon>
</cr-button> </cr-button>
<a id="alreadyChanged" hidden="[[!clickedChangePassword]]" <a id="alreadyChanged" hidden="[[!clickedChangePassword]]"
......
...@@ -59,7 +59,19 @@ Polymer({ ...@@ -59,7 +59,19 @@ Polymer({
clickedChangePassword: { clickedChangePassword: {
type: Boolean, type: Boolean,
value: false, value: false,
} },
/** @private */
buttonClass_: {
type: String,
computed: 'computeButtonClass_(item.compromisedInfo)',
},
/** @private */
iconClass_: {
type: String,
computed: 'computeIconClass_(item.compromisedInfo)',
},
}, },
/** /**
...@@ -138,6 +150,32 @@ Polymer({ ...@@ -138,6 +150,32 @@ Polymer({
return !!this.item.password; return !!this.item.password;
}, },
/**
* @return {string}
* @private
*/
computeButtonClass_() {
if (this.item.compromisedInfo) {
// Strong CTA.
return 'action-button';
}
// Weak CTA.
return '';
},
/**
* @return {string}
* @private
*/
computeIconClass_() {
if (this.item.compromisedInfo) {
// Strong CTA, white icon.
return '';
}
// Weak CTA, non-white-icon.
return 'icon-weak-cta';
},
/** /**
* @return {string} * @return {string}
* @private * @private
......
...@@ -674,6 +674,26 @@ suite('PasswordsCheckSection', function() { ...@@ -674,6 +674,26 @@ suite('PasswordsCheckSection', function() {
expectFalse(icon.classList.contains('no-security-issues')); expectFalse(icon.classList.contains('no-security-issues'));
}); });
// Test that leaked password items have a strong CTA.
test('showStrongCtaOnLeaks', function() {
const password = makeCompromisedCredential('one.com', 'test6', 'LEAKED');
const passwordCheckListItem = createLeakedPasswordItem(password);
const button = passwordCheckListItem.$$('#changePasswordButton');
assertTrue(button.classList.contains('action-button'));
const icon = passwordCheckListItem.$$('iron-icon');
assertFalse(icon.classList.contains('icon-weak-cta'));
});
// Tests that weak password items have a weak CTA.
test('showWeakCtaOnWeaksPasswords', function() {
const password = makeInsecureCredential('one.com', 'test7');
const passwordCheckListItem = createLeakedPasswordItem(password);
const button = passwordCheckListItem.$$('#changePasswordButton');
assertFalse(button.classList.contains('action-button'));
const icon = passwordCheckListItem.$$('iron-icon');
assertTrue(icon.classList.contains('icon-weak-cta'));
});
// Tests that the spinner is replaced with a warning on errors. // Tests that the spinner is replaced with a warning on errors.
test('showsInfoIconWhenFinishedWithErrors', async function() { test('showsInfoIconWhenFinishedWithErrors', async function() {
passwordManager.data.checkStatus = makePasswordCheckStatus( passwordManager.data.checkStatus = makePasswordCheckStatus(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment