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

Unified Diff: components/autofill/content/renderer/password_form_conversion_utils.cc

Issue 1161023008: Suggest to fill password change forms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renaming and showing password field suggestions rarely Created 5 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/autofill/content/renderer/password_form_conversion_utils.cc
diff --git a/components/autofill/content/renderer/password_form_conversion_utils.cc b/components/autofill/content/renderer/password_form_conversion_utils.cc
index e27e482ac4b46aad2da8990eb99fa7e163402eda..a346af0464d5cb2e46f57674883af93a93066af2 100644
--- a/components/autofill/content/renderer/password_form_conversion_utils.cc
+++ b/components/autofill/content/renderer/password_form_conversion_utils.cc
@@ -143,13 +143,17 @@ bool LocateSpecificPasswords(std::vector<WebInputElement> passwords,
*current_password = passwords[0];
break;
case 2:
- if (passwords[0].value() == passwords[1].value()) {
- // Two identical passwords: assume we are seeing a new password with a
- // confirmation. This can be either a sign-up form or a password change
- // form that does not ask for the old password.
+ if (!passwords[0].value().isEmpty() &&
Garrett Casto 2015/06/12 00:09:09 Can you add a test for this?
dvadym 2015/06/12 17:22:37 Done. I've fixed corresponding test in password_fo
+ passwords[0].value() == passwords[1].value()) {
+ // Two identical non-empty passwords: assume we are seeing a new
+ // password with a confirmation. This can be either a sign-up form or a
+ // password change form that does not ask for the old password.
*new_password = passwords[0];
} else {
// Assume first is old password, second is new (no choice but to guess).
+ // This case also includes empty passwords in order to allow filling of
+ // password change forms (that also could autofill for sign up form, but
+ // we can't do anything with this using only client side information).
*current_password = passwords[0];
*new_password = passwords[1];
}

Powered by Google App Engine
This is Rietveld 408576698