dont try to fill unless has username and password

This commit is contained in:
Kyle Spearrin 2018-10-07 07:40:44 -04:00
parent 8632f7cadc
commit 726db336a8
2 changed files with 18 additions and 3 deletions

View file

@ -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"),

View file

@ -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 =>