mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-02 13:13:31 +01:00
Enhancement to login field detection for Android autofill (#2561)
This commit is contained in:
parent
04e30c2146
commit
1332ef7b43
@ -54,16 +54,15 @@ namespace Bit.Droid.Autofill
|
|||||||
if (HintToFieldsMap.ContainsKey(View.AutofillHintPassword))
|
if (HintToFieldsMap.ContainsKey(View.AutofillHintPassword))
|
||||||
{
|
{
|
||||||
_passwordFields.AddRange(HintToFieldsMap[View.AutofillHintPassword]);
|
_passwordFields.AddRange(HintToFieldsMap[View.AutofillHintPassword]);
|
||||||
|
return _passwordFields;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_passwordFields = Fields.Where(f => FieldIsPassword(f)).ToList();
|
_passwordFields = Fields.Where(f => FieldIsPassword(f)).ToList();
|
||||||
if (!_passwordFields.Any())
|
if (!_passwordFields.Any())
|
||||||
{
|
{
|
||||||
_passwordFields = Fields.Where(f => FieldHasPasswordTerms(f)).ToList();
|
_passwordFields = Fields.Where(f => FieldHasPasswordTerms(f)).ToList();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return _passwordFields;
|
return _passwordFields;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,9 +86,12 @@ namespace Bit.Droid.Autofill
|
|||||||
{
|
{
|
||||||
_usernameFields.AddRange(HintToFieldsMap[View.AutofillHintUsername]);
|
_usernameFields.AddRange(HintToFieldsMap[View.AutofillHintUsername]);
|
||||||
}
|
}
|
||||||
}
|
if (_usernameFields.Any())
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
return _usernameFields;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var passwordField in PasswordFields)
|
foreach (var passwordField in PasswordFields)
|
||||||
{
|
{
|
||||||
var usernameField = Fields.TakeWhile(f => f.AutofillId != passwordField.AutofillId)
|
var usernameField = Fields.TakeWhile(f => f.AutofillId != passwordField.AutofillId)
|
||||||
@ -104,7 +106,6 @@ namespace Bit.Droid.Autofill
|
|||||||
{
|
{
|
||||||
_usernameFields = Fields.Where(f => FieldIsUsername(f)).ToList();
|
_usernameFields = Fields.Where(f => FieldIsUsername(f)).ToList();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return _usernameFields;
|
return _usernameFields;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user