Compare commits
1 Commits
2488-fix-c
...
2458--seed
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c934755e1c |
@@ -434,7 +434,7 @@ namespace Kp2aAutofillParser
|
|||||||
public static List<string> ConvertToCanonicalLowerCaseHints(string[] supportedHints)
|
public static List<string> ConvertToCanonicalLowerCaseHints(string[] supportedHints)
|
||||||
{
|
{
|
||||||
List<string> result = new List<string>();
|
List<string> result = new List<string>();
|
||||||
foreach (string hint in supportedHints.Where(h => h != null))
|
foreach (string hint in supportedHints)
|
||||||
{
|
{
|
||||||
var canonicalHint = ToCanonicalHint(hint);
|
var canonicalHint = ToCanonicalHint(hint);
|
||||||
result.Add(canonicalHint.ToLower());
|
result.Add(canonicalHint.ToLower());
|
||||||
@@ -829,7 +829,7 @@ namespace Kp2aAutofillParser
|
|||||||
// * if there is no such autofill hint, we use IsPassword to
|
// * if there is no such autofill hint, we use IsPassword to
|
||||||
|
|
||||||
HashSet<string> autofillHintsOfAllFields = autofillView.InputFields.Where(f => f.AutofillHints != null)
|
HashSet<string> autofillHintsOfAllFields = autofillView.InputFields.Where(f => f.AutofillHints != null)
|
||||||
.SelectMany(f => f.AutofillHints).Where(x => x != null).Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet();
|
.SelectMany(f => f.AutofillHints).Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet();
|
||||||
bool hasLoginAutofillHints = autofillHintsOfAllFields.Intersect(_autofillHintsForLogin).Any();
|
bool hasLoginAutofillHints = autofillHintsOfAllFields.Intersect(_autofillHintsForLogin).Any();
|
||||||
|
|
||||||
if (hasLoginAutofillHints)
|
if (hasLoginAutofillHints)
|
||||||
@@ -839,9 +839,9 @@ namespace Kp2aAutofillParser
|
|||||||
string[] viewHints = viewNode.AutofillHints;
|
string[] viewHints = viewNode.AutofillHints;
|
||||||
if (viewHints == null)
|
if (viewHints == null)
|
||||||
continue;
|
continue;
|
||||||
if (viewHints.Where(h => h != null).Select(AutofillHintsHelper.ToCanonicalHint).Intersect(_autofillHintsForLogin).Any())
|
if (viewHints.Select(AutofillHintsHelper.ToCanonicalHint).Intersect(_autofillHintsForLogin).Any())
|
||||||
{
|
{
|
||||||
AddFieldToHintMap(viewNode, viewHints.Where(h => h != null).Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet().ToArray());
|
AddFieldToHintMap(viewNode, viewHints.Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet().ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,17 +31,8 @@ namespace PluginTOTP
|
|||||||
_muteWarnings = muteWarnings;
|
_muteWarnings = muteWarnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if specified Entry contains Settings that are not null.
|
internal bool HasSeed(IDictionary<string, string> entryFields)
|
||||||
/// </summary>
|
|
||||||
internal bool SettingsCheck(IDictionary<string, string> entryFields)
|
|
||||||
{
|
|
||||||
string settings;
|
|
||||||
entryFields.TryGetValue(SettingsFieldName, out settings);
|
|
||||||
return !String.IsNullOrEmpty(settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal bool SeedCheck(IDictionary<string, string> entryFields)
|
|
||||||
{
|
{
|
||||||
string seed;
|
string seed;
|
||||||
entryFields.TryGetValue(SeedFieldName, out seed);
|
entryFields.TryGetValue(SeedFieldName, out seed);
|
||||||
@@ -100,15 +91,15 @@ namespace PluginTOTP
|
|||||||
}
|
}
|
||||||
|
|
||||||
private string[] SettingsGet(IDictionary<string, string> entryFields)
|
private string[] SettingsGet(IDictionary<string, string> entryFields)
|
||||||
{
|
{
|
||||||
return entryFields[SettingsFieldName].Split(';');
|
return entryFields.TryGetValue(SettingsFieldName, out var settings) ? settings.Split(';') : new[] { "30", "6" };
|
||||||
}
|
}
|
||||||
|
|
||||||
public TotpData GetTotpData(IDictionary<string, string> entryFields)
|
public TotpData GetTotpData(IDictionary<string, string> entryFields)
|
||||||
{
|
{
|
||||||
TotpData res = new TotpData();
|
TotpData res = new TotpData();
|
||||||
|
|
||||||
if (SettingsCheck(entryFields) && SeedCheck(entryFields))
|
if (HasSeed(entryFields))
|
||||||
{
|
{
|
||||||
bool ValidInterval; bool ValidLength; bool ValidUrl;
|
bool ValidInterval; bool ValidLength; bool ValidUrl;
|
||||||
if (SettingsValidate(entryFields, out ValidInterval, out ValidLength, out ValidUrl))
|
if (SettingsValidate(entryFields, out ValidInterval, out ValidLength, out ValidUrl))
|
||||||
|
|||||||
Reference in New Issue
Block a user