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

Unified Diff: components/autofill/browser/personal_data_manager.cc

Issue 13760005: Allows profile import from forms with 'confirm email' field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review revisions. Created 7 years, 8 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
« no previous file with comments | « no previous file | components/autofill/browser/personal_data_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/browser/personal_data_manager.cc
diff --git a/components/autofill/browser/personal_data_manager.cc b/components/autofill/browser/personal_data_manager.cc
index 4eb595621e675d060baf83a0407c6a9fe03cb70a..6fa3c45c598648ce1341a2b9d491dc2c851fff55 100644
--- a/components/autofill/browser/personal_data_manager.cc
+++ b/components/autofill/browser/personal_data_manager.cc
@@ -114,8 +114,10 @@ bool IsValidFieldTypeAndValue(const std::set<AutofillFieldType>& types_seen,
// Abandon the import if two fields of the same type are encountered.
// This indicates ambiguous data or miscategorization of types.
// Make an exception for PHONE_HOME_NUMBER however as both prefix and
- // suffix are stored against this type.
- if (types_seen.count(field_type) && field_type != PHONE_HOME_NUMBER)
+ // suffix are stored against this type, and for EMAIL_ADDRESS because it is
+ // common to see second 'confirm email address' fields on forms.
+ if (types_seen.count(field_type) && field_type != PHONE_HOME_NUMBER &&
+ field_type != EMAIL_ADDRESS)
return false;
// Abandon the import if an email address value shows up in a field that is
@@ -249,6 +251,17 @@ bool PersonalDataManager::ImportFormData(
AutofillFieldType field_type = field->type();
FieldTypeGroup group(AutofillType(field_type).group());
+ // There can be multiple email fields (e.g. in the case of 'confirm email'
+ // fields) but they must all contain the same value, else the profile is
+ // invalid.
+ if (field_type == EMAIL_ADDRESS) {
+ if (types_seen.count(field_type) &&
+ imported_profile->GetRawInfo(field_type) != value) {
+ imported_profile.reset();
+ break;
+ }
+ }
+
// If the |field_type| and |value| don't pass basic validity checks then
// abandon the import.
if (!IsValidFieldTypeAndValue(types_seen, field_type, value)) {
« no previous file with comments | « no previous file | components/autofill/browser/personal_data_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698