Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Unified Diff: components/password_manager/core/browser/password_form_manager.cc

Issue 356223002: PasswordForm: move from current/old password scheme to current/new. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/password_form_manager.cc
diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc
index 5f7d21fe499d74f674d9b1950df562abe54acdb1..92b51a0225776199a9c649ce40b3b3b61effae31 100644
--- a/components/password_manager/core/browser/password_form_manager.cc
+++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -222,11 +222,22 @@ bool PasswordFormManager::HasValidPasswordForm() {
}
void PasswordFormManager::ProvisionallySave(
- const PasswordForm& credentials,
+ PasswordForm credentials,
OtherPossibleUsernamesAction action) {
DCHECK_EQ(state_, POST_MATCHING_PHASE);
DCHECK(DoesManage(credentials, ACTION_MATCH_NOT_REQUIRED));
+ // At this point, if this is a sign-up or change password form, promote the
+ // new password element/value to be the current password element/value, so the
+ // below logic can handle these cases the same way it handles login forms
+ // where the user has manually entered the password.
+ if (!credentials.new_password_element.empty()) {
+ credentials.password_element.swap(credentials.new_password_element);
+ credentials.password_value.swap(credentials.new_password_value);
+ credentials.new_password_element.clear();
+ credentials.new_password_value.clear();
+ }
+
// Make sure the important fields stay the same as the initially observed or
// autofilled ones, as they may have changed if the user experienced a login
// failure.
@@ -444,9 +455,11 @@ void PasswordFormManager::OnGetPasswordStoreResults(
}
bool PasswordFormManager::IgnoreResult(const PasswordForm& form) const {
- // Ignore change password forms until we have some change password
- // functionality
- if (observed_form_.old_password_element.length() != 0) {
+ // Ignore matches for sign-up and change password forms that do not ask for
+ // old password, as there is nothing we can fill, and we do not yet have
+ // change password functionality.
+ if (observed_form_.password_element.length() == 0 &&
vabr (Chromium) 2014/06/30 10:07:20 Please use .empty() instead of checking the length
engedy 2014/07/03 13:34:19 Done. Plus, as per offline discussion, we opted no
+ observed_form_.new_password_element.length() != 0) {
return true;
}
// Don't match an invalid SSL form with one saved under secure

Powered by Google App Engine
This is Rietveld 408576698