1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-21 11:25:56 +01:00

add master password reprompt to share sheet extension (#1922)

This commit is contained in:
Jake Fink 2022-05-23 16:01:04 -04:00 committed by GitHub
parent a259560d29
commit 58d7b001a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,8 @@ using MobileCoreServices;
using Bit.iOS.Core.Controllers;
using Bit.App.Resources;
using Bit.iOS.Core.Views;
using Bit.App.Abstractions;
using Bit.Core.Utilities;
namespace Bit.iOS.Extension
{
@ -18,10 +20,12 @@ namespace Bit.iOS.Extension
: base(handle)
{
DismissModalAction = Cancel;
PasswordRepromptService = ServiceContainer.Resolve<IPasswordRepromptService>("passwordRepromptService");
}
public Context Context { get; set; }
public LoadingViewController LoadingController { get; set; }
public IPasswordRepromptService PasswordRepromptService { get; private set; }
public async override void ViewDidLoad()
{
@ -104,7 +108,7 @@ namespace Bit.iOS.Extension
_controller = controller;
}
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
public async override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
tableView.DeselectRow(indexPath, true);
tableView.EndEditing(true);
@ -122,6 +126,11 @@ namespace Bit.iOS.Extension
return;
}
if (item.Reprompt != Bit.Core.Enums.CipherRepromptType.None && !await _controller.PasswordRepromptService.ShowPasswordPromptAsync())
{
return;
}
if (_controller.CanAutoFill() && !string.IsNullOrWhiteSpace(item.Password))
{
string totp = null;