mirror of
https://github.com/bitwarden/android.git
synced 2025-01-11 18:57:39 +03:00
make sure totp copy isn't available if not premium
This commit is contained in:
parent
6c5979040f
commit
43cee53dc8
2 changed files with 17 additions and 8 deletions
|
@ -651,15 +651,19 @@ namespace Bit.Droid.Services
|
|||
|
||||
private async Task CopyTotpAsync(CipherView cipher)
|
||||
{
|
||||
var autoCopyDisabled = await _storageService.GetAsync<bool?>(Constants.DisableAutoTotpCopyKey);
|
||||
var canAccessPremium = await ServiceContainer.Resolve<IUserService>("userService").CanAccessPremiumAsync();
|
||||
if((canAccessPremium || cipher.OrganizationUseTotp) && !autoCopyDisabled.GetValueOrDefault() &&
|
||||
!string.IsNullOrWhiteSpace(cipher?.Login?.Totp))
|
||||
if(!string.IsNullOrWhiteSpace(cipher?.Login?.Totp))
|
||||
{
|
||||
var totp = await ServiceContainer.Resolve<ITotpService>("totpService").GetCodeAsync(cipher.Login.Totp);
|
||||
if(totp != null)
|
||||
var userService = ServiceContainer.Resolve<IUserService>("userService");
|
||||
var autoCopyDisabled = await _storageService.GetAsync<bool?>(Constants.DisableAutoTotpCopyKey);
|
||||
var canAccessPremium = await userService.CanAccessPremiumAsync();
|
||||
if((canAccessPremium || cipher.OrganizationUseTotp) && !autoCopyDisabled.GetValueOrDefault())
|
||||
{
|
||||
CopyToClipboard(totp);
|
||||
var totpService = ServiceContainer.Resolve<ITotpService>("totpService");
|
||||
var totp = await totpService.GetCodeAsync(cipher.Login.Totp);
|
||||
if(totp != null)
|
||||
{
|
||||
CopyToClipboard(totp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,12 @@ namespace Bit.App.Utilities
|
|||
}
|
||||
if(!string.IsNullOrWhiteSpace(cipher.Login.Totp))
|
||||
{
|
||||
options.Add(AppResources.CopyTotp);
|
||||
var userService = ServiceContainer.Resolve<IUserService>("userService");
|
||||
var canAccessPremium = await userService.CanAccessPremiumAsync();
|
||||
if(canAccessPremium || cipher.OrganizationUseTotp)
|
||||
{
|
||||
options.Add(AppResources.CopyTotp);
|
||||
}
|
||||
}
|
||||
if(cipher.Login.CanLaunch)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue