Commit f9f3470a authored by Jialiu Lin's avatar Jialiu Lin Committed by Commit Bot

Save sync password hash upon "Sign in again"

Save sync password hash when user clicks "Sign in again" button in the
account menu. This sync password hash is used to detect gaia password
reuses.

Bug: 790824
Change-Id: I420162773e03fb5b99341a6da6c96a49a2a1efba
Reviewed-on: https://chromium-review.googlesource.com/879468Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: Jialiu Lin <jialiul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532126}
parent 97256229
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_attributes_entry.h" #include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/profiles/profile_attributes_storage.h"
...@@ -51,6 +52,8 @@ ...@@ -51,6 +52,8 @@
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
#include "components/browser_sync/profile_sync_service.h" #include "components/browser_sync/profile_sync_service.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/password_manager/core/browser/password_store.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/signin/core/browser/about_signin_internals.h" #include "components/signin/core/browser/about_signin_internals.h"
#include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/account_tracker_service.h"
...@@ -230,6 +233,20 @@ void InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened( ...@@ -230,6 +233,20 @@ void InlineSigninHelper::OnClientOAuthSuccessAndBrowserOpened(
LocalAuth::SetLocalAuthCredentials(profile_, password_); LocalAuth::SetLocalAuthCredentials(profile_, password_);
} }
#if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
if (!password_.empty()) {
scoped_refptr<password_manager::PasswordStore> password_store =
PasswordStoreFactory::GetForProfile(profile_,
ServiceAccessType::EXPLICIT_ACCESS);
if (password_store) {
password_store->SaveSyncPasswordHash(base::UTF8ToUTF16(password_));
password_manager::metrics_util::LogSyncPasswordHashChange(
password_manager::metrics_util::SyncPasswordHashChange::
SAVED_ON_CHROME_SIGNIN);
}
}
#endif
if (reason == signin_metrics::Reason::REASON_REAUTHENTICATION || if (reason == signin_metrics::Reason::REASON_REAUTHENTICATION ||
reason == signin_metrics::Reason::REASON_UNLOCK || reason == signin_metrics::Reason::REASON_UNLOCK ||
reason == signin_metrics::Reason::REASON_ADD_SECONDARY_ACCOUNT) { reason == signin_metrics::Reason::REASON_ADD_SECONDARY_ACCOUNT) {
......
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