diff --git a/src/Core/GlobalSettings.cs b/src/Core/GlobalSettings.cs index 239915e2eb..92589069aa 100644 --- a/src/Core/GlobalSettings.cs +++ b/src/Core/GlobalSettings.cs @@ -18,7 +18,6 @@ namespace Bit.Core public virtual bool DisableUserRegistration { get; set; } public virtual bool DisableEmailNewDevice { get; set; } public virtual int OrganizationInviteExpirationHours { get; set; } = 120; // 5 days - public virtual string AppleIapPassword { get; set; } public virtual InstallationSettings Installation { get; set; } = new InstallationSettings(); public virtual BaseServiceUriSettings BaseServiceUri { get; set; } = new BaseServiceUriSettings(); public virtual SqlSettings SqlServer { get; set; } = new SqlSettings(); @@ -39,6 +38,7 @@ namespace Bit.Core public virtual BitPaySettings BitPay { get; set; } = new BitPaySettings(); public virtual AmazonSettings Amazon { get; set; } = new AmazonSettings(); public virtual ServiceBusSettings ServiceBus { get; set; } = new ServiceBusSettings(); + public virtual AppleIapSettings AppleIap { get; set; } = new AppleIapSettings(); public class BaseServiceUriSettings { @@ -219,5 +219,11 @@ namespace Bit.Core public string ApplicationCacheTopicName { get; set; } public string ApplicationCacheSubscriptionName { get; set; } } + + public class AppleIapSettings + { + public string Password { get; set; } + public bool AppInReview { get; set; } + } } } diff --git a/src/Core/Services/Implementations/AppleIapService.cs b/src/Core/Services/Implementations/AppleIapService.cs index dfd93aaed0..f02fac7d32 100644 --- a/src/Core/Services/Implementations/AppleIapService.cs +++ b/src/Core/Services/Implementations/AppleIapService.cs @@ -40,7 +40,8 @@ namespace Bit.Core.Services { return null; } - var validEnvironment = (!_hostingEnvironment.IsProduction() && receiptStatus.Environment == "Sandbox") || + var validEnvironment = _globalSettings.AppleIap.AppInReview || + (!_hostingEnvironment.IsProduction() && receiptStatus.Environment == "Sandbox") || (_hostingEnvironment.IsProduction() && receiptStatus.Environment != "Sandbox"); var validProductBundle = receiptStatus.Receipt.BundleId == "com.bitwarden.desktop" || receiptStatus.Receipt.BundleId == "com.8bit.bitwarden"; @@ -95,7 +96,7 @@ namespace Bit.Core.Services var url = string.Format("https://{0}.itunes.apple.com/verifyReceipt", prod ? "buy" : "sandbox"); var json = new JObject(new JProperty("receipt-data", receiptData), - new JProperty("password", _globalSettings.AppleIapPassword)).ToString(); + new JProperty("password", _globalSettings.AppleIap.Password)).ToString(); var response = await _httpClient.PostAsync(url, new StringContent(json)); if(response.IsSuccessStatusCode)