1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-27 21:53:57 +00:00

Password reprompt (#1365)

* Make card number hidden

* Add support for password reprompt

* Rename PasswordPrompt to Reprompt

* Protect autofill

* Use Enums.CipherRepromptType

* Fix iOS not building

* Protect iOS autofill

* Update to match jslib

* Fix failing build
This commit is contained in:
Oscar Hinton
2021-05-21 15:13:54 +02:00
committed by GitHub
parent e61bcd2785
commit 976eeab6d7
36 changed files with 401 additions and 55 deletions

View File

@@ -18,6 +18,7 @@ namespace Bit.iOS.Core.Models
Totp = cipher.Login?.Totp;
Uris = cipher.Login?.Uris?.Select(u => new LoginUriModel(u)).ToList();
Fields = cipher.Fields?.Select(f => new Tuple<string, string>(f.Name, f.Value)).ToList();
Reprompt = cipher.Reprompt;
}
public string Id { get; set; }
@@ -28,6 +29,7 @@ namespace Bit.iOS.Core.Models
public string Totp { get; set; }
public List<Tuple<string, string>> Fields { get; set; }
public CipherView CipherView { get; set; }
public CipherRepromptType Reprompt { get; set; }
public class LoginUriModel
{

View File

@@ -200,7 +200,7 @@ namespace Bit.iOS.Core.Services
public Task<string> DisplayPromptAync(string title = null, string description = null,
string text = null, string okButtonText = null, string cancelButtonText = null,
bool numericKeyboard = false, bool autofocus = true)
bool numericKeyboard = false, bool autofocus = true, bool password = false)
{
var result = new TaskCompletionSource<string>();
var alert = UIAlertController.Create(title ?? string.Empty, description, UIAlertControllerStyle.Alert);
@@ -223,6 +223,9 @@ namespace Bit.iOS.Core.Services
{
input.KeyboardType = UIKeyboardType.NumberPad;
}
if (password) {
input.SecureTextEntry = true;
}
if (!ThemeHelpers.LightTheme)
{
input.KeyboardAppearance = UIKeyboardAppearance.Dark;

View File

@@ -55,6 +55,9 @@ namespace Bit.iOS.Core.Utilities
var platformUtilsService = new MobilePlatformUtilsService(deviceActionService, messagingService,
broadcasterService);
var biometricService = new BiometricService(mobileStorageService);
var cryptoFunctionService = new PclCryptoFunctionService(cryptoPrimitiveService);
var cryptoService = new CryptoService(mobileStorageService, secureStorageService, cryptoFunctionService);
var passwordRepromptService = new MobilePasswordRepromptService(platformUtilsService, cryptoService);
ServiceContainer.Register<IBroadcasterService>("broadcasterService", broadcasterService);
ServiceContainer.Register<IMessagingService>("messagingService", messagingService);
@@ -66,6 +69,9 @@ namespace Bit.iOS.Core.Utilities
ServiceContainer.Register<IDeviceActionService>("deviceActionService", deviceActionService);
ServiceContainer.Register<IPlatformUtilsService>("platformUtilsService", platformUtilsService);
ServiceContainer.Register<IBiometricService>("biometricService", biometricService);
ServiceContainer.Register<ICryptoFunctionService>("cryptoFunctionService", cryptoFunctionService);
ServiceContainer.Register<ICryptoService>("cryptoService", cryptoService);
ServiceContainer.Register<IPasswordRepromptService>("passwordRepromptService", passwordRepromptService);
}
public static void Bootstrap(Func<Task> postBootstrapFunc = null)