mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-25 02:32:26 -05:00
check for duplicate keys in entry edit
This commit is contained in:
parent
4fb1ae996a
commit
565438a630
@ -1015,6 +1015,7 @@ namespace keepass2android
|
||||
|
||||
|
||||
LinearLayout container = (LinearLayout) FindViewById(Resource.Id.advanced_container);
|
||||
HashSet<string> allKeys = new HashSet<string>();
|
||||
for (int i = 0; i < container.ChildCount; i++) {
|
||||
View ees = container.GetChildAt(i);
|
||||
|
||||
@ -1025,7 +1026,15 @@ namespace keepass2android
|
||||
Toast.MakeText(this, Resource.String.error_string_key, ToastLength.Long).Show();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (allKeys.Contains(key))
|
||||
{
|
||||
Toast.MakeText(this, GetString(Resource.String.error_string_duplicate_key, new Java.Lang.Object[]{key}), ToastLength.Long).Show();
|
||||
return false;
|
||||
}
|
||||
|
||||
allKeys.Add(key);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -277,6 +277,7 @@
|
||||
|
||||
<string name="error_invalid_expiry_date">Invalid date/time format for expiry date!</string>
|
||||
<string name="error_string_key">A field name is required for each string.</string>
|
||||
<string name="error_string_duplicate_key">A field name cannot be used twice (%1$s).</string>
|
||||
<string name="field_name">Field Name</string>
|
||||
<string name="field_value">Field value</string>
|
||||
<string name="protection">Protected field</string>
|
||||
|
Loading…
Reference in New Issue
Block a user