diff --git a/src/App/Pages/Send/SendAddEditPageViewModel.cs b/src/App/Pages/Send/SendAddEditPageViewModel.cs index 60e2bb5e1..332456f5b 100644 --- a/src/App/Pages/Send/SendAddEditPageViewModel.cs +++ b/src/App/Pages/Send/SendAddEditPageViewModel.cs @@ -21,8 +21,10 @@ namespace Bit.App.Pages private readonly IMessagingService _messagingService; private readonly IUserService _userService; private readonly ISendService _sendService; + private readonly ITokenService _tokenService; private bool _sendEnabled; private bool _canAccessPremium; + private bool _emailVerified; private SendView _send; private string _fileName; private bool _showOptions; @@ -53,6 +55,7 @@ namespace Bit.App.Pages _messagingService = ServiceContainer.Resolve("messagingService"); _userService = ServiceContainer.Resolve("userService"); _sendService = ServiceContainer.Resolve("sendService"); + _tokenService = ServiceContainer.Resolve("tokenService"); TogglePasswordCommand = new Command(TogglePassword); TypeOptions = new List> @@ -221,6 +224,7 @@ namespace Bit.App.Pages { PageTitle = EditMode ? AppResources.EditSend : AppResources.AddSend; _canAccessPremium = await _userService.CanAccessPremiumAsync(); + _emailVerified = _tokenService.GetEmailVerified(); SendEnabled = ! await AppHelpers.IsSendDisabledByPolicyAsync(); DisableHideEmail = await AppHelpers.IsHideEmailDisabledByPolicyAsync(); SendOptionsPolicyInEffect = SendEnabled && DisableHideEmail; @@ -246,7 +250,7 @@ namespace Bit.App.Pages } else { - var defaultType = _canAccessPremium ? SendType.File : SendType.Text; + var defaultType = _canAccessPremium && _emailVerified ? SendType.File : SendType.Text; Send = new SendView { Type = Type.GetValueOrDefault(defaultType), @@ -340,6 +344,11 @@ namespace Bit.App.Pages await _platformUtilsService.ShowDialogAsync(AppResources.SendFilePremiumRequired); return false; } + if (!_emailVerified) + { + await _platformUtilsService.ShowDialogAsync(AppResources.SendFileEmailVerificationRequired); + return false; + } if (!EditMode) { if (FileData == null) @@ -459,9 +468,17 @@ namespace Bit.App.Pages } if (Send != null) { - if (!EditMode && type == SendType.File && !_canAccessPremium) + if (!EditMode && type == SendType.File && (!_canAccessPremium || !_emailVerified)) { - await _platformUtilsService.ShowDialogAsync(AppResources.SendFilePremiumRequired); + if (!_canAccessPremium) + { + await _platformUtilsService.ShowDialogAsync(AppResources.SendFilePremiumRequired); + } + else if (!_emailVerified) + { + await _platformUtilsService.ShowDialogAsync(AppResources.SendFileEmailVerificationRequired); + } + if (IsAddFromShare && Device.RuntimePlatform == Device.Android) { _deviceActionService.CloseMainApp(); diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index d3a274b19..db4e20abb 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -3502,5 +3502,11 @@ namespace Bit.App.Resources { return ResourceManager.GetString("SendFilePremiumRequired", resourceCulture); } } + + public static string SendFileEmailVerificationRequired { + get { + return ResourceManager.GetString("SendFileEmailVerificationRequired", resourceCulture); + } + } } } diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 95236c98a..f6518c92d 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -1983,4 +1983,8 @@ Free accounts are restricted to sharing text only. A premium membership is required to use files with Send. 'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated. + + You must verify your email to use files with Send. + 'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated. +