From 58d7b001a5bc8459bf2d4b40fe952b03a64506b8 Mon Sep 17 00:00:00 2001 From: Jake Fink Date: Mon, 23 May 2022 16:01:04 -0400 Subject: [PATCH] add master password reprompt to share sheet extension (#1922) --- src/iOS.Extension/LoginListViewController.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/iOS.Extension/LoginListViewController.cs b/src/iOS.Extension/LoginListViewController.cs index ea7917c76..3df4654d4 100644 --- a/src/iOS.Extension/LoginListViewController.cs +++ b/src/iOS.Extension/LoginListViewController.cs @@ -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("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;