mirror of
https://github.com/bitwarden/mobile.git
synced 2025-02-27 03:01:56 +01:00
make sure totp copy isn't available if not premium
This commit is contained in:
parent
6c5979040f
commit
43cee53dc8
@ -651,18 +651,22 @@ namespace Bit.Droid.Services
|
|||||||
|
|
||||||
private async Task CopyTotpAsync(CipherView cipher)
|
private async Task CopyTotpAsync(CipherView cipher)
|
||||||
{
|
{
|
||||||
var autoCopyDisabled = await _storageService.GetAsync<bool?>(Constants.DisableAutoTotpCopyKey);
|
if(!string.IsNullOrWhiteSpace(cipher?.Login?.Totp))
|
||||||
var canAccessPremium = await ServiceContainer.Resolve<IUserService>("userService").CanAccessPremiumAsync();
|
|
||||||
if((canAccessPremium || cipher.OrganizationUseTotp) && !autoCopyDisabled.GetValueOrDefault() &&
|
|
||||||
!string.IsNullOrWhiteSpace(cipher?.Login?.Totp))
|
|
||||||
{
|
{
|
||||||
var totp = await ServiceContainer.Resolve<ITotpService>("totpService").GetCodeAsync(cipher.Login.Totp);
|
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())
|
||||||
|
{
|
||||||
|
var totpService = ServiceContainer.Resolve<ITotpService>("totpService");
|
||||||
|
var totp = await totpService.GetCodeAsync(cipher.Login.Totp);
|
||||||
if(totp != null)
|
if(totp != null)
|
||||||
{
|
{
|
||||||
CopyToClipboard(totp);
|
CopyToClipboard(totp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CopyToClipboard(string text)
|
private void CopyToClipboard(string text)
|
||||||
{
|
{
|
||||||
|
@ -28,9 +28,14 @@ namespace Bit.App.Utilities
|
|||||||
options.Add(AppResources.CopyPassword);
|
options.Add(AppResources.CopyPassword);
|
||||||
}
|
}
|
||||||
if(!string.IsNullOrWhiteSpace(cipher.Login.Totp))
|
if(!string.IsNullOrWhiteSpace(cipher.Login.Totp))
|
||||||
|
{
|
||||||
|
var userService = ServiceContainer.Resolve<IUserService>("userService");
|
||||||
|
var canAccessPremium = await userService.CanAccessPremiumAsync();
|
||||||
|
if(canAccessPremium || cipher.OrganizationUseTotp)
|
||||||
{
|
{
|
||||||
options.Add(AppResources.CopyTotp);
|
options.Add(AppResources.CopyTotp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(cipher.Login.CanLaunch)
|
if(cipher.Login.CanLaunch)
|
||||||
{
|
{
|
||||||
options.Add(AppResources.Launch);
|
options.Add(AppResources.Launch);
|
||||||
|
Loading…
Reference in New Issue
Block a user