diff --git a/src/App/Pages/Accounts/RegisterPage.xaml b/src/App/Pages/Accounts/RegisterPage.xaml index 9cb687b04..5df2c77f7 100644 --- a/src/App/Pages/Accounts/RegisterPage.xaml +++ b/src/App/Pages/Accounts/RegisterPage.xaml @@ -123,6 +123,39 @@ Text="{u:I18n MasterPasswordHintDescription}" StyleClass="box-footer-label" /> + + + + + + diff --git a/src/App/Pages/Accounts/RegisterPageViewModel.cs b/src/App/Pages/Accounts/RegisterPageViewModel.cs index fd6728661..c383fa1e5 100644 --- a/src/App/Pages/Accounts/RegisterPageViewModel.cs +++ b/src/App/Pages/Accounts/RegisterPageViewModel.cs @@ -7,6 +7,7 @@ using Bit.Core.Models.Request; using Bit.Core.Utilities; using System; using System.Threading.Tasks; +using System.Windows.Input; using Xamarin.Forms; namespace Bit.App.Pages @@ -18,6 +19,7 @@ namespace Bit.App.Pages private readonly ICryptoService _cryptoService; private readonly IPlatformUtilsService _platformUtilsService; private bool _showPassword; + private bool _acceptPolicies; public RegisterPageViewModel() { @@ -30,7 +32,13 @@ namespace Bit.App.Pages TogglePasswordCommand = new Command(TogglePassword); ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword); SubmitCommand = new Command(async () => await SubmitAsync()); + ShowTerms = !_platformUtilsService.IsSelfHost(); } + + public ICommand PoliciesClickCommand => new Command((url) => + { + _platformUtilsService.LaunchUri(url); + }); public bool ShowPassword { @@ -41,7 +49,21 @@ namespace Bit.App.Pages nameof(ShowPasswordIcon) }); } - + + public bool AcceptPolicies + { + get => _acceptPolicies; + set => SetProperty(ref _acceptPolicies, value); + } + + public Thickness SwitchMargin + { + get => Device.RuntimePlatform == Device.Android + ? new Thickness(0, 0, 0, 0) + : new Thickness(0, 0, 10, 0); + } + + public bool ShowTerms { get; set; } public Command SubmitCommand { get; } public Command TogglePasswordCommand { get; } public Command ToggleConfirmPasswordCommand { get; } @@ -93,6 +115,12 @@ namespace Bit.App.Pages AppResources.MasterPasswordConfirmationValMessage, AppResources.Ok); return; } + if (ShowTerms && !AcceptPolicies) + { + await Page.DisplayAlert(AppResources.AnErrorHasOccurred, + AppResources.AcceptPoliciesError, AppResources.Ok); + return; + } // TODO: Password strength check? diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index bc5e3f12a..9a496acf9 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -3050,5 +3050,29 @@ namespace Bit.App.Resources { return ResourceManager.GetString("Loading", resourceCulture); } } + + public static string AcceptPolicies { + get { + return ResourceManager.GetString("AcceptPolicies", resourceCulture); + } + } + + public static string AcceptPoliciesError { + get { + return ResourceManager.GetString("AcceptPoliciesError", resourceCulture); + } + } + + public static string TermsOfService { + get { + return ResourceManager.GetString("TermsOfService", resourceCulture); + } + } + + public static string PrivacyPolicy { + get { + return ResourceManager.GetString("PrivacyPolicy", resourceCulture); + } + } } } diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 69590d849..450fefafb 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -1731,4 +1731,17 @@ Loading + + By activating this switch you agree to the following: + + + + Terms of Service and Privacy Policy have not been acknowledged. + + + Terms of Service + + + Privacy Policy + \ No newline at end of file