[GDPR] Adjusted TOS/Privacy acceptance (#1138)

* GDPR acceptance flows

* Added specialized margin by platform

* Changed property name
This commit is contained in:
Vincent Salucci 2020-11-05 10:50:18 -06:00 committed by GitHub
parent 75b6e69d34
commit 82c96555dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 99 additions and 1 deletions

View file

@ -123,6 +123,39 @@
Text="{u:I18n MasterPasswordHintDescription}" Text="{u:I18n MasterPasswordHintDescription}"
StyleClass="box-footer-label" /> StyleClass="box-footer-label" />
</StackLayout> </StackLayout>
<StackLayout StyleClass="box">
<StackLayout StyleClass="box-row, box-row-switch"
IsVisible="{Binding ShowTerms}">
<Switch
IsToggled="{Binding AcceptPolicies}"
StyleClass="box-value"
HorizontalOptions="Start"
Margin="{Binding SwitchMargin}"/>
<Label StyleClass="box-footer-label"
HorizontalOptions="Fill">
<Label.FormattedText>
<FormattedString>
<Span Text="{u:I18n AcceptPolicies}" />
<Span Text="{u:I18n TermsOfService}"
TextColor="Blue">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding PoliciesClickCommand}"
CommandParameter="https://bitwarden.com/terms/" />
</Span.GestureRecognizers>
</Span>
<Span Text=", " />
<Span Text="{u:I18n PrivacyPolicy}"
TextColor="Blue">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding PoliciesClickCommand}"
CommandParameter="https://bitwarden.com/privacy/" />
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>
</StackLayout>
</StackLayout> </StackLayout>
</ScrollView> </ScrollView>

View file

@ -7,6 +7,7 @@ using Bit.Core.Models.Request;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms; using Xamarin.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
@ -18,6 +19,7 @@ namespace Bit.App.Pages
private readonly ICryptoService _cryptoService; private readonly ICryptoService _cryptoService;
private readonly IPlatformUtilsService _platformUtilsService; private readonly IPlatformUtilsService _platformUtilsService;
private bool _showPassword; private bool _showPassword;
private bool _acceptPolicies;
public RegisterPageViewModel() public RegisterPageViewModel()
{ {
@ -30,7 +32,13 @@ namespace Bit.App.Pages
TogglePasswordCommand = new Command(TogglePassword); TogglePasswordCommand = new Command(TogglePassword);
ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword); ToggleConfirmPasswordCommand = new Command(ToggleConfirmPassword);
SubmitCommand = new Command(async () => await SubmitAsync()); SubmitCommand = new Command(async () => await SubmitAsync());
ShowTerms = !_platformUtilsService.IsSelfHost();
} }
public ICommand PoliciesClickCommand => new Command<string>((url) =>
{
_platformUtilsService.LaunchUri(url);
});
public bool ShowPassword public bool ShowPassword
{ {
@ -41,7 +49,21 @@ namespace Bit.App.Pages
nameof(ShowPasswordIcon) 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 SubmitCommand { get; }
public Command TogglePasswordCommand { get; } public Command TogglePasswordCommand { get; }
public Command ToggleConfirmPasswordCommand { get; } public Command ToggleConfirmPasswordCommand { get; }
@ -93,6 +115,12 @@ namespace Bit.App.Pages
AppResources.MasterPasswordConfirmationValMessage, AppResources.Ok); AppResources.MasterPasswordConfirmationValMessage, AppResources.Ok);
return; return;
} }
if (ShowTerms && !AcceptPolicies)
{
await Page.DisplayAlert(AppResources.AnErrorHasOccurred,
AppResources.AcceptPoliciesError, AppResources.Ok);
return;
}
// TODO: Password strength check? // TODO: Password strength check?

View file

@ -3050,5 +3050,29 @@ namespace Bit.App.Resources {
return ResourceManager.GetString("Loading", resourceCulture); 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);
}
}
} }
} }

View file

@ -1731,4 +1731,17 @@
<data name="Loading" xml:space="preserve"> <data name="Loading" xml:space="preserve">
<value>Loading</value> <value>Loading</value>
</data> </data>
<data name="AcceptPolicies" xml:space="preserve">
<value>By activating this switch you agree to the following:
</value>
</data>
<data name="AcceptPoliciesError" xml:space="preserve">
<value>Terms of Service and Privacy Policy have not been acknowledged.</value>
</data>
<data name="TermsOfService" xml:space="preserve">
<value>Terms of Service</value>
</data>
<data name="PrivacyPolicy" xml:space="preserve">
<value>Privacy Policy</value>
</data>
</root> </root>