mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
dont try to fill unless has username and password
This commit is contained in:
parent
8632f7cadc
commit
726db336a8
2 changed files with 18 additions and 3 deletions
|
@ -147,7 +147,7 @@ namespace Bit.iOS.Autofill
|
|||
return;
|
||||
}
|
||||
|
||||
if(_context == null || string.IsNullOrWhiteSpace(password))
|
||||
if(_context == null || string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password))
|
||||
{
|
||||
_googleAnalyticsService.TrackAutofillExtensionEvent("Canceled");
|
||||
var err = new NSError(new NSString("ASExtensionErrorDomain"),
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Bit.iOS.Autofill.Utilities
|
|||
return;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(item.Password))
|
||||
if(!string.IsNullOrWhiteSpace(item.Username) && !string.IsNullOrWhiteSpace(item.Password))
|
||||
{
|
||||
string totp = null;
|
||||
if(!settings.GetValueOrDefault(App.Constants.SettingDisableTotpCopy, false))
|
||||
|
@ -41,7 +41,8 @@ namespace Bit.iOS.Autofill.Utilities
|
|||
|
||||
cpViewController.CompleteRequest(item.Username, item.Password, totp);
|
||||
}
|
||||
else if(!string.IsNullOrWhiteSpace(item.Username) || !string.IsNullOrWhiteSpace(item.Totp.Value))
|
||||
else if(!string.IsNullOrWhiteSpace(item.Username) || !string.IsNullOrWhiteSpace(item.Password) ||
|
||||
!string.IsNullOrWhiteSpace(item.Totp.Value))
|
||||
{
|
||||
var sheet = Dialogs.CreateActionSheet(item.Name, controller);
|
||||
if(!string.IsNullOrWhiteSpace(item.Username))
|
||||
|
@ -58,6 +59,20 @@ namespace Bit.iOS.Autofill.Utilities
|
|||
}));
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(item.Password))
|
||||
{
|
||||
sheet.AddAction(UIAlertAction.Create(AppResources.CopyPassword, UIAlertActionStyle.Default, a =>
|
||||
{
|
||||
UIPasteboard clipboard = UIPasteboard.General;
|
||||
clipboard.String = item.Password;
|
||||
var alert = Dialogs.CreateMessageAlert(AppResources.CopiedPassword);
|
||||
controller.PresentViewController(alert, true, () =>
|
||||
{
|
||||
controller.DismissViewController(true, null);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(item.Totp.Value))
|
||||
{
|
||||
sheet.AddAction(UIAlertAction.Create(AppResources.CopyTotp, UIAlertActionStyle.Default, a =>
|
||||
|
|
Loading…
Reference in a new issue