Commit a312e36b authored by Esmael El-Moslimany's avatar Esmael El-Moslimany Committed by Commit Bot

Settings: passwords and forms, clear password from view on update

Bug: 865899
Change-Id: Ic759da99d5dd11f2e08b201b731bab8006da7b38
Reviewed-on: https://chromium-review.googlesource.com/1145625
Commit-Queue: Esmael El-Moslimany <aee@chromium.org>
Reviewed-by: default avatarScott Chen <scottchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577625}
parent f994a90a
...@@ -10,14 +10,17 @@ ...@@ -10,14 +10,17 @@
Polymer({ Polymer({
is: 'password-list-item', is: 'password-list-item',
behaviors: [FocusRowBehavior, ShowPasswordBehavior], behaviors: [
FocusRowBehavior,
ShowPasswordBehavior,
],
/** /**
* Selects the password on tap if revealed. * Selects the password on tap if revealed.
* @private * @private
*/ */
onReadonlyInputTap_: function() { onReadonlyInputTap_: function() {
if (this.password) if (this.item.password)
this.$$('#password').select(); this.$$('#password').select();
}, },
......
...@@ -150,25 +150,30 @@ Polymer({ ...@@ -150,25 +150,30 @@ Polymer({
/** @override */ /** @override */
attached: function() { attached: function() {
// The item uid is built from index, origin, and username for the
// following reasons: origin and username are enough to describe and
// uniquely identify an entry. It is impossible to have two entries
// that have the same origin and username, but different passwords,
// as the password update logic prevents these cases. The entry is
// required to force a refresh of entries, after a removal or undo of
// a removal has taken place. All entries before the point of
// modification are uneffected, but the ones following need to be
// refreshed. Including the index in the uid achieves this effect.
// See https://crbug.com/862119 how this could lead to bugs otherwise.
const getItemUid =
item => [item.entry.index, item.entry.loginPair.urls.origin,
item.entry.loginPair.username]
.join('_');
// Create listener functions. // Create listener functions.
const setSavedPasswordsListener = list => const setSavedPasswordsListener = list => {
this.updateList('savedPasswords', item => { const newList = list.map(entry => ({entry: entry, password: ''}));
// The item uid is built from index, origin, and username for the this.updateList('savedPasswords', getItemUid, newList);
// following reasons: origin and username are enough to describe and this.savedPasswords.forEach((item, index) => {
// uniquely identify an entry. It is impossible to have two entries item.password = '';
// that have the same origin and username, but different passwords, this.$.passwordList.notifyPath(`items.${index}.password`);
// as the password update logic prevents these cases. The entry is });
// required to force a refresh of entries, after a removal or undo of };
// a removal has taken place. All entries before the point of
// modification are uneffected, but the ones following need to be
// refreshed. Including the index in the uid achieves this effect.
// See https://crbug.com/862119 how this could lead to bugs otherwise.
return item.entry.index + '_' + item.entry.loginPair.urls.origin +
'_' + item.entry.loginPair.username;
}, list.map(entry => ({
entry: entry,
password: '',
})));
const setPasswordExceptionsListener = list => { const setPasswordExceptionsListener = list => {
this.passwordExceptions = list; this.passwordExceptions = list;
......
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