mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-26 12:16:07 +01:00
[PS-2486] Finally stop filling password into username field (#2367)
* Finally stop filling password into username field The logic in #2331 is unfortunately not very reliable as it'll only detect fields that have one of "email", "phone" or "username" in their id as username fields. This commit ensures that additonally fields that have TextVariationWebEmailAddress are also detected as username fields. * Add TextVariationEmailAddress * Remove --------- Co-authored-by: aj-rosado <109146700+aj-rosado@users.noreply.github.com>
This commit is contained in:
parent
fe12b0e908
commit
ad9ca125a0
@ -102,7 +102,7 @@ namespace Bit.Droid.Autofill
|
||||
|
||||
if (!_usernameFields.Any())
|
||||
{
|
||||
_usernameFields = Fields.Where(f => FieldHasUsernameTerms(f)).ToList();
|
||||
_usernameFields = Fields.Where(f => FieldIsUsername(f)).ToList();
|
||||
}
|
||||
}
|
||||
return _usernameFields;
|
||||
@ -327,13 +327,18 @@ namespace Bit.Droid.Autofill
|
||||
}
|
||||
|
||||
return inputTypePassword && !ValueContainsAnyTerms(f.IdEntry, _ignoreSearchTerms) &&
|
||||
!ValueContainsAnyTerms(f.Hint, _ignoreSearchTerms) && !FieldHasUsernameTerms(f);
|
||||
!ValueContainsAnyTerms(f.Hint, _ignoreSearchTerms) && !FieldIsUsername(f);
|
||||
}
|
||||
|
||||
private bool FieldHasPasswordTerms(Field f)
|
||||
{
|
||||
return ValueContainsAnyTerms(f.IdEntry, _passwordTerms) || ValueContainsAnyTerms(f.Hint, _passwordTerms);
|
||||
}
|
||||
|
||||
private bool FieldIsUsername(Field f)
|
||||
{
|
||||
return f.InputType.HasFlag(InputTypes.TextVariationWebEmailAddress) || FieldHasUsernameTerms(f);
|
||||
}
|
||||
|
||||
private bool FieldHasUsernameTerms(Field f)
|
||||
{
|
||||
@ -350,4 +355,4 @@ namespace Bit.Droid.Autofill
|
||||
return terms.Any(t => lowerValue.Contains(t));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user