mirror of
https://github.com/bitwarden/android.git
synced 2024-12-26 02:48:29 +03: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
1 changed files with 8 additions and 3 deletions
|
@ -102,7 +102,7 @@ namespace Bit.Droid.Autofill
|
||||||
|
|
||||||
if (!_usernameFields.Any())
|
if (!_usernameFields.Any())
|
||||||
{
|
{
|
||||||
_usernameFields = Fields.Where(f => FieldHasUsernameTerms(f)).ToList();
|
_usernameFields = Fields.Where(f => FieldIsUsername(f)).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _usernameFields;
|
return _usernameFields;
|
||||||
|
@ -327,7 +327,7 @@ namespace Bit.Droid.Autofill
|
||||||
}
|
}
|
||||||
|
|
||||||
return inputTypePassword && !ValueContainsAnyTerms(f.IdEntry, _ignoreSearchTerms) &&
|
return inputTypePassword && !ValueContainsAnyTerms(f.IdEntry, _ignoreSearchTerms) &&
|
||||||
!ValueContainsAnyTerms(f.Hint, _ignoreSearchTerms) && !FieldHasUsernameTerms(f);
|
!ValueContainsAnyTerms(f.Hint, _ignoreSearchTerms) && !FieldIsUsername(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool FieldHasPasswordTerms(Field f)
|
private bool FieldHasPasswordTerms(Field f)
|
||||||
|
@ -335,6 +335,11 @@ namespace Bit.Droid.Autofill
|
||||||
return ValueContainsAnyTerms(f.IdEntry, _passwordTerms) || ValueContainsAnyTerms(f.Hint, _passwordTerms);
|
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)
|
private bool FieldHasUsernameTerms(Field f)
|
||||||
{
|
{
|
||||||
return ValueContainsAnyTerms(f.IdEntry, _usernameTerms) || ValueContainsAnyTerms(f.Hint, _usernameTerms);
|
return ValueContainsAnyTerms(f.IdEntry, _usernameTerms) || ValueContainsAnyTerms(f.Hint, _usernameTerms);
|
||||||
|
|
Loading…
Reference in a new issue