From 68e9cd3779d0278525997a4f0fadc8d9a44914b9 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 21 Sep 2018 23:32:26 -0400 Subject: [PATCH] only copy totp key is setting not disabled --- .../CredentialProviderViewController.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/iOS.Autofill/CredentialProviderViewController.cs b/src/iOS.Autofill/CredentialProviderViewController.cs index 467359d86..ead6e58c9 100644 --- a/src/iOS.Autofill/CredentialProviderViewController.cs +++ b/src/iOS.Autofill/CredentialProviderViewController.cs @@ -24,7 +24,8 @@ namespace Bit.iOS.Autofill { private Context _context; private bool _setupHockeyApp = false; - private IGoogleAnalyticsService _googleAnalyticsService; + private IGoogleAnalyticsService _googleAnalyticsService; + private ISettings _settings; public CredentialProviderViewController(IntPtr handle) : base(handle) { } @@ -36,7 +37,8 @@ namespace Bit.iOS.Autofill base.ViewDidLoad(); _context = new Context(); _context.ExtContext = ExtensionContext; - _googleAnalyticsService = Resolver.Resolve(); + _googleAnalyticsService = Resolver.Resolve(); + _settings = Resolver.Resolve(); if(!_setupHockeyApp) { @@ -234,11 +236,14 @@ namespace Bit.iOS.Autofill return; } - var totpKey = cipher.Login.Totp?.Decrypt(cipher.OrganizationId); string totpCode = null; - if(!string.IsNullOrWhiteSpace(totpKey)) + if(!_settings.GetValueOrDefault(App.Constants.SettingDisableTotpCopy, false)) { - totpCode = Crypto.Totp(totpKey); + var totpKey = cipher.Login.Totp?.Decrypt(cipher.OrganizationId); + if(!string.IsNullOrWhiteSpace(totpKey)) + { + totpCode = Crypto.Totp(totpKey); + } } CompleteRequest(cipher.Login.Username?.Decrypt(cipher.OrganizationId),