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;
// PasswordStore, etc.
class CredentialsFilter {
public:
CredentialsFilter() {}
virtual ~CredentialsFilter() {}
CredentialsFilter() = default;
virtual ~CredentialsFilter() = default;
// 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;
// Returns true if the hash of the password in |form| should be saved for Gaia
......
......@@ -931,7 +931,12 @@ void PasswordManager::OnLoginSuccessful() {
// TODO(https://crbug.com/831123): Implement checking whether to save with
// 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())) {
RecordProvisionalSaveFailure(
PasswordManagerMetricsRecorder::SYNC_CREDENTIAL,
......
......@@ -17,8 +17,6 @@
#include "components/signin/public/identity_manager/identity_manager.h"
#include "google_apis/gaia/gaia_auth_util.h"
using autofill::PasswordForm;
namespace password_manager {
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