Commit 88a21a96 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Password manager: Allow updating the Sync account password

Bug: 1110878
Change-Id: I92b45b1a8b97e4e00814886a66e646fb727681dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2333837
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794621}
parent d6b154e1
...@@ -16,10 +16,12 @@ class PasswordFormManager; ...@@ -16,10 +16,12 @@ class PasswordFormManager;
// PasswordStore, etc. // PasswordStore, etc.
class CredentialsFilter { class CredentialsFilter {
public: public:
CredentialsFilter() {} CredentialsFilter() = default;
virtual ~CredentialsFilter() {} virtual ~CredentialsFilter() = default;
// Should |form| be offered to be saved? // Should |form| be offered to be saved?
// Note that this only refers to *saving* - *updating* an already stored
// credential should still be allowed even if this returns false!
virtual bool ShouldSave(const autofill::PasswordForm& form) const = 0; virtual bool ShouldSave(const autofill::PasswordForm& form) const = 0;
// Returns true if the hash of the password in |form| should be saved for Gaia // Returns true if the hash of the password in |form| should be saved for Gaia
......
...@@ -931,7 +931,12 @@ void PasswordManager::OnLoginSuccessful() { ...@@ -931,7 +931,12 @@ void PasswordManager::OnLoginSuccessful() {
// TODO(https://crbug.com/831123): Implement checking whether to save with // TODO(https://crbug.com/831123): Implement checking whether to save with
// PasswordFormManager. // PasswordFormManager.
if (!client_->GetStoreResultFilter()->ShouldSave( // Check whether the filter allows saving this credential. In practice, this
// prevents saving the password of the syncing account. However, if the
// password is already saved, then *updating* it is still allowed - better
// than keeping an outdated password around.
if (!submitted_manager->IsPasswordUpdate() &&
!client_->GetStoreResultFilter()->ShouldSave(
*submitted_manager->GetSubmittedForm())) { *submitted_manager->GetSubmittedForm())) {
RecordProvisionalSaveFailure( RecordProvisionalSaveFailure(
PasswordManagerMetricsRecorder::SYNC_CREDENTIAL, PasswordManagerMetricsRecorder::SYNC_CREDENTIAL,
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
#include "components/signin/public/identity_manager/identity_manager.h" #include "components/signin/public/identity_manager/identity_manager.h"
#include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/gaia_auth_util.h"
using autofill::PasswordForm;
namespace password_manager { namespace password_manager {
SyncCredentialsFilter::SyncCredentialsFilter( SyncCredentialsFilter::SyncCredentialsFilter(
......
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