diff --git a/src/App/Pages/Vault/CipherDetailsPage.xaml.cs b/src/App/Pages/Vault/CipherDetailsPage.xaml.cs index d0566fe96..4fac27e6d 100644 --- a/src/App/Pages/Vault/CipherDetailsPage.xaml.cs +++ b/src/App/Pages/Vault/CipherDetailsPage.xaml.cs @@ -204,7 +204,7 @@ namespace Bit.App.Pages } } - private async void More_Clicked(object sender, System.EventArgs e) + private async void More_Clicked(object sender, EventArgs e) { if (!DoOnce()) { @@ -214,7 +214,11 @@ namespace Bit.App.Pages var options = new List { AppResources.Attachments }; if (_vm.Cipher.OrganizationId == null) { - options.Add(AppResources.Clone); + if (_vm.CanClone) + { + options.Add(AppResources.Clone); + } + options.Add(AppResources.MoveToOrganization); } else @@ -288,13 +292,13 @@ namespace Bit.App.Pages { ToolbarItems.Remove(_collectionsItem); } - if (_vm.Cipher.Type != Core.Enums.CipherType.Fido2Key && !ToolbarItems.Contains(_cloneItem)) + if (_vm.CanClone && !ToolbarItems.Contains(_cloneItem)) { ToolbarItems.Insert(1, _cloneItem); } if (!ToolbarItems.Contains(_shareItem)) { - ToolbarItems.Insert(_vm.Cipher.Type == Core.Enums.CipherType.Fido2Key ? 1 : 2, _shareItem); + ToolbarItems.Insert(_vm.CanClone ? 2 : 1, _shareItem); } } else diff --git a/src/App/Pages/Vault/CipherDetailsPageViewModel.cs b/src/App/Pages/Vault/CipherDetailsPageViewModel.cs index d58143e23..0336ea4ea 100644 --- a/src/App/Pages/Vault/CipherDetailsPageViewModel.cs +++ b/src/App/Pages/Vault/CipherDetailsPageViewModel.cs @@ -249,6 +249,7 @@ namespace Bit.App.Pages public double TotpProgress => string.IsNullOrEmpty(TotpSec) ? 0 : double.Parse(TotpSec) * 100 / _totpInterval; public bool IsDeleted => Cipher.IsDeleted; public bool CanEdit => !Cipher.IsDeleted; + public bool CanClone => Cipher.IsClonable; public async Task LoadAsync(Action finishedLoadingAction = null) { @@ -707,6 +708,12 @@ namespace Bit.App.Pages private async Task CanCloneAsync() { + if (Cipher.Type == CipherType.Fido2Key) + { + await _platformUtilsService.ShowDialogAsync(AppResources.PasskeyWillNotBeCopied); + return false; + } + if (Cipher.Type == CipherType.Login && Cipher.Login?.Fido2Key != null) { return await _platformUtilsService.ShowDialogAsync(AppResources.ThePasskeyWillNotBeCopiedToTheClonedItemDoYouWantToContinueCloningThisItem, AppResources.PasskeyWillNotBeCopied, AppResources.Yes, AppResources.No); diff --git a/src/Core/Models/View/CipherView.cs b/src/Core/Models/View/CipherView.cs index a29ebb38c..8e2202847 100644 --- a/src/Core/Models/View/CipherView.cs +++ b/src/Core/Models/View/CipherView.cs @@ -120,5 +120,7 @@ namespace Bit.Core.Models.View public bool CanLaunch => Login?.CanLaunch == true || Fido2Key?.CanLaunch == true; public string LaunchUri => Login?.LaunchUri ?? Fido2Key?.LaunchUri; + + public bool IsClonable => OrganizationId is null && Type != CipherType.Fido2Key; } }