Commit f6c4be61 authored by Viktor Semeniuk's avatar Viktor Semeniuk Committed by Commit Bot

[Passwords] Apps representation in compromised credentials

This change adds special handling for compromised credentials from
mobile apps. Instead of a button Change password user see a label which
tells him to open the app and change password there.

Bug: 1047726
Change-Id: I29c633015a0dcbe22949d5ba7fe97b79883b63d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087583Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Viktor Semeniuk <vsemeniuk@google.com>
Cr-Commit-Position: refs/heads/master@{#748219}
parent b7b033eb
......@@ -341,6 +341,9 @@
<message name="IDS_SETTINGS_CHANGE_PASSWORD_BUTTON" desc="Button inside password check section which opens url for changing leaked password.">
Change password
</message>
<message name="IDS_SETTINGS_CHANGE_PASSWORD_IN_APP_LABEL" desc="Label which is shown only if compromised credentials can't be fixed by visiting website (e.g. password from mobile app).">
Open the app to change your password
</message>
<message name="IDS_SETTINGS_COMPROMISED_PASSWORD_REASON_LEAKED" desc="Password compromise reason shown when a password was found in a data breach.">
Found in data breach
</message>
......
8138fdfdf26bc43fe1802a2b621b68e613c46bbc
\ No newline at end of file
......@@ -65,7 +65,8 @@
</div>
</div>
</div>
<div class="button-container">
<template is="dom-if" if="[[item.changePasswordUrl]]">
<div class="button-container" id="changePasswordUrl">
<!-- TODO:(https://crbug.com/1047726) add 'Already changed this password?' link -->
<cr-button class="action-button" on-click="onChangePasswordClick_">
$i18n{changePasswordButton}
......@@ -73,6 +74,10 @@
</iron-icon>
</cr-button>
</div>
</template>
<template is="dom-if" if="[[!item.changePasswordUrl]]">
<span id="changePasswordInApp">$i18n{changePasswordInApp}</span>
</template>
<cr-icon-button class="icon-more-vert" id="more"
title="$i18n{moreActions}" on-click="onMoreClick_">
</cr-icon-button>
......
......@@ -737,6 +737,7 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
{"compromisedPasswordsDescription",
IDS_SETTINGS_COMPROMISED_PASSWORDS_ADVICE},
{"changePasswordButton", IDS_SETTINGS_CHANGE_PASSWORD_BUTTON},
{"changePasswordInApp", IDS_SETTINGS_CHANGE_PASSWORD_IN_APP_LABEL},
{"leakedPassword", IDS_SETTINGS_COMPROMISED_PASSWORD_REASON_LEAKED},
{"phishedPassword", IDS_SETTINGS_COMPROMISED_PASSWORD_REASON_PHISHED},
{"noCompromisedCredentials",
......
......@@ -14,6 +14,19 @@ cr.define('settings_passwords_check', function() {
return passwordsSection;
}
/**
* Helper method used to create a compromised list item.
* @param {!chrome.passwordsPrivate.CompromisedCredential} entry
* @return {!PasswordCheckListItemElement}
*/
function createLeakedPasswordItem(entry) {
const leakedPasswordItem =
this.document.createElement('password-check-list-item');
leakedPasswordItem.item = entry;
document.body.appendChild(leakedPasswordItem);
Polymer.dom.flush();
return leakedPasswordItem;
}
/**
* Helper method that validates a that elements in the compromised credentials
......@@ -98,6 +111,17 @@ cr.define('settings_passwords_check', function() {
});
});
// Test verifies that credentials from mobile app shown correctly
test('testSomeCompromisedCredentials', function() {
const password = autofill_test_util.makeCompromisedCredentials(
'one.com', 'test4', 'LEAKED');
password.changePasswordUrl = null;
const checkPasswordSection = createLeakedPasswordItem(password);
assertEquals(checkPasswordSection.$$('changePasswordUrl'), null);
assert(checkPasswordSection.$$('#changePasswordInApp'));
});
// Verify that the More Actions menu opens when the button is clicked.
test('testMoreActionsMenu', function() {
const leakedPasswords = [
......
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